code stringlengths 22 1.05M | apis listlengths 1 3.31k | extract_api stringlengths 75 3.25M |
|---|---|---|
from textwrap import dedent
import os
import subprocess
import numpy
import pandas
from wqio.tests import helpers
from wqio.utils import numutils
def _sig_figs(x):
""" Wrapper around `utils.sigFig` (n=3, tex=True) requiring only
argument for the purpose of easily "apply"-ing it to a pandas
dataframe.
... | [
"textwrap.dedent",
"wqio.utils.numutils.sigFigs",
"pandas.read_csv",
"os.getcwd",
"os.path.isfile",
"numpy.array",
"os.chdir",
"os.path.dirname",
"wqio.tests.helpers.checkdep_tex",
"subprocess.call",
"numpy.nonzero",
"os.remove"
] | [((338, 372), 'wqio.utils.numutils.sigFigs', 'numutils.sigFigs', (['x'], {'n': '(3)', 'tex': '(True)'}), '(x, n=3, tex=True)\n', (354, 372), False, 'from wqio.utils import numutils\n'), ((687, 714), 'numpy.array', 'numpy.array', (['df.index.names'], {}), '(df.index.names)\n', (698, 714), False, 'import numpy\n'), ((725... |
'''
test_edit_preclusion_backend.py
Contains test cases for functions to edit preclusions.
'''
from nose.tools import assert_equal, assert_false, assert_true
from components import model
# HOW TO RUN NOSE TESTS
# 1. Make sure you are in cs-modify main directory
# 2. Make sure the path "C:\Python27\Scripts" is... | [
"components.model.add_preclusion",
"components.model.add_module",
"components.model.get_prerequisite",
"components.model.get_preclusion",
"components.model.delete_module",
"components.model.edit_preclusion",
"components.model.add_prerequisite",
"nose.tools.assert_true",
"components.model.delete_all_... | [((2043, 2179), 'components.model.add_module', 'model.add_module', (['self.test_module_code', 'self.test_module_name', 'self.test_module_desc', 'self.test_module_mc', 'self.test_module_status'], {}), '(self.test_module_code, self.test_module_name, self.\n test_module_desc, self.test_module_mc, self.test_module_statu... |
import asyncio
import json
import multiprocessing
import random
from functools import partial
from typing import Set, Callable, List, Iterator
import numpy as np
import torch
from torch import nn
import backgammon.game as bg
class RandomAgent(bg.Agent):
"""Random Player."""
def get_action(self, available_m... | [
"backgammon.game.Board.from_schema",
"asyncio.start_server",
"json.dumps",
"torch.from_numpy",
"numpy.zeros",
"asyncio.open_connection",
"functools.partial",
"numpy.argmin",
"multiprocessing.Pipe"
] | [((2669, 2694), 'functools.partial', 'partial', (['cls'], {'model': 'model'}), '(cls, model=model)\n', (2676, 2694), False, 'from functools import partial\n'), ((4171, 4198), 'multiprocessing.Pipe', 'multiprocessing.Pipe', (['(False)'], {}), '(False)\n', (4191, 4198), False, 'import multiprocessing\n'), ((937, 982), 'n... |
"""
Provides the molior python logging wrapper.
"""
import logging
import logging.config
from pathlib import Path
import yaml
LOGGING_CFG_FILE = Path("/etc/molior/logging.yml")
def init_logger():
"""
Initializes logger
"""
if LOGGING_CFG_FILE.exists():
with LOGGING_CFG_FILE.open() as log_cfg:... | [
"logging.getLogger",
"yaml.load",
"pathlib.Path"
] | [((146, 177), 'pathlib.Path', 'Path', (['"""/etc/molior/logging.yml"""'], {}), "('/etc/molior/logging.yml')\n", (150, 177), False, 'from pathlib import Path\n'), ((764, 787), 'logging.getLogger', 'logging.getLogger', (['name'], {}), '(name)\n', (781, 787), False, 'import logging\n'), ((380, 398), 'yaml.load', 'yaml.loa... |
#!/usr/bin/env python3
import json
import base64
import requests
import random
def print_template(name):
if any(exclusion in name for exclusion in exclusions):
return
if random.randint(1, 3) == 1: # 1 of 3 should have a picture
base64image = try_get_an_image(name)
else:
base64imag... | [
"json.load",
"random.randint",
"requests.get"
] | [((765, 790), 'json.load', 'json.load', (['locations_file'], {}), '(locations_file)\n', (774, 790), False, 'import json\n'), ((477, 501), 'random.randint', 'random.randint', (['(200)', '(500)'], {}), '(200, 500)\n', (491, 501), False, 'import random\n'), ((510, 534), 'random.randint', 'random.randint', (['(100)', '(300... |
import numpy as np
def sigmoid(x):
return 1 / (1 + np.exp(-x))
def log_loss(x, y, eps=1e-6):
x = np.clip(x, eps, 1-eps)
return -(y*np.log(x) + (1-y)*np.log(1-x)) | [
"numpy.clip",
"numpy.exp",
"numpy.log"
] | [((109, 133), 'numpy.clip', 'np.clip', (['x', 'eps', '(1 - eps)'], {}), '(x, eps, 1 - eps)\n', (116, 133), True, 'import numpy as np\n'), ((57, 67), 'numpy.exp', 'np.exp', (['(-x)'], {}), '(-x)\n', (63, 67), True, 'import numpy as np\n'), ((147, 156), 'numpy.log', 'np.log', (['x'], {}), '(x)\n', (153, 156), True, 'impo... |
from __future__ import print_function
import sys
sys.path.append('/usr/lib/freecad/lib')
print(sys.path)
import FreeCAD
import ImportGui
import FreeCADGui
import os
import Draft
# FIXME assumes standoff of 0.5mm
# all distances in mm
MMTOMIL = 0.3937
directory = sys.argv[2]; name = sys.argv[3]; pitch = float(sys.argv... | [
"FreeCAD.ActiveDocument.getObject",
"os.path.join",
"FreeCAD.ActiveDocument.removeObject",
"FreeCAD.Vector",
"sys.path.append",
"FreeCAD.getDocument"
] | [((49, 88), 'sys.path.append', 'sys.path.append', (['"""/usr/lib/freecad/lib"""'], {}), "('/usr/lib/freecad/lib')\n", (64, 88), False, 'import sys\n'), ((3740, 3792), 'FreeCAD.ActiveDocument.getObject', 'FreeCAD.ActiveDocument.getObject', (['"""HorizontalFusion"""'], {}), "('HorizontalFusion')\n", (3772, 3792), False, ... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
from db.BOW_DB import BOW_DB
from db.LDA_DB import LDA_DB
from vis.TermTopicMatrix3 import TermTopicMatrix3
def index():
with BOW_DB() as bow_db:
with LDA_DB() as lda_db:
handler = TermTopicMatrix3(request, response, bow_db, lda_db)
return handler.Gener... | [
"db.BOW_DB.BOW_DB",
"vis.TermTopicMatrix3.TermTopicMatrix3",
"json.dumps",
"db.LDA_DB.LDA_DB"
] | [((509, 569), 'json.dumps', 'json.dumps', (['data'], {'encoding': '"""utf-8"""', 'indent': '(2)', 'sort_keys': '(True)'}), "(data, encoding='utf-8', indent=2, sort_keys=True)\n", (519, 569), False, 'import json\n'), ((818, 878), 'json.dumps', 'json.dumps', (['data'], {'encoding': '"""utf-8"""', 'indent': '(2)', 'sort_k... |
from xml.etree.ElementTree import XMLParser
class MaxDepth:
maxdepth = 0
depth = 0
# Called for each opening tag
def start(self, tag, attrib):
self.depth += 1
if self.depth > self.maxdepth:
self.maxdepth = self.depth
# Called for each closing tag
def end(self, tag... | [
"xml.etree.ElementTree.XMLParser"
] | [((573, 597), 'xml.etree.ElementTree.XMLParser', 'XMLParser', ([], {'target': 'target'}), '(target=target)\n', (582, 597), False, 'from xml.etree.ElementTree import XMLParser\n')] |
# -*- coding: utf-8 -*-
"""
Created on Thu Apr 16 17:54:18 2015
@author: anderson
"""
from setuptools import setup
import io
import version
def read(*filenames, **kwargs):
encoding = kwargs.get('encoding', 'utf-8')
sep = kwargs.get('sep', '\n')
buf = []
for filename in filenames:
with io.op... | [
"setuptools.setup",
"io.open"
] | [((456, 793), 'setuptools.setup', 'setup', ([], {'name': '"""pyspyke"""', 'version': 'version.version', 'description': '"""Python Package to analyse Spyke"""', 'long_description': 'long_description', 'url': '"""https://github.com/britodasilva/pyspyke.git"""', 'uthor': '"""<NAME>"""', 'author_email': '"""<EMAIL>"""', 'l... |
import re
from typing import NamedTuple
import numpy as np
EVENT_TAG = '<event>'
INIT_TAG = '<init>'
INIT_END_TAG = '</init>'
FILE_END_TAG = '</LesHouchesEvents>'
class Parameters(NamedTuple):
id_a : int # IDBMUP(1)
id_b : int # IDBMUP(2)
energy_a : float # EBMUP(1)
energy_b : float # EBMUP(2)
pdf... | [
"re.sub"
] | [((1663, 1688), 're.sub', 're.sub', (['"""\\\\s+"""', '""" """', 'line'], {}), "('\\\\s+', ' ', line)\n", (1669, 1688), False, 'import re\n'), ((2019, 2044), 're.sub', 're.sub', (['"""\\\\s+"""', '""" """', 'line'], {}), "('\\\\s+', ' ', line)\n", (2025, 2044), False, 'import re\n'), ((2289, 2314), 're.sub', 're.sub', ... |
import random
import _jsonnet, json
import logging
import hashlib
import os
from copy import deepcopy
import pandas as pd
from tqdm import tqdm
import math
from LeapOfThought.resources.teachai_kb import TeachAIKB
from LeapOfThought.common.general import num2words1, bc
from LeapOfThought.common.data_utils import unifor... | [
"logging.getLogger",
"copy.deepcopy",
"numpy.random.RandomState",
"pandas.set_option",
"numpy.random.seed",
"pandas.DataFrame",
"random.sample",
"hashlib.md5",
"random.shuffle",
"LeapOfThought.common.data_utils.pandas_multi_column_agg",
"os.path.abspath",
"logging.basicConfig",
"pandas.Serie... | [((413, 451), 'pandas.set_option', 'pd.set_option', (['"""display.max_rows"""', '(500)'], {}), "('display.max_rows', 500)\n", (426, 451), True, 'import pandas as pd\n'), ((452, 493), 'pandas.set_option', 'pd.set_option', (['"""display.max_columns"""', '(500)'], {}), "('display.max_columns', 500)\n", (465, 493), True, '... |
import os
import pygame
from pygame.locals import *
from pygame.compat import geterror
from globals import DELTAX, DELTAY
main_dir = os.path.split(os.path.abspath(__file__))[0]
data_dir = os.path.join(main_dir, 'data')
def load_image(name, colorkey=None):
fullname = os.path.join(data_dir, name)
try:
... | [
"os.path.abspath",
"pygame.image.load",
"os.path.join",
"pygame.compat.geterror"
] | [((192, 222), 'os.path.join', 'os.path.join', (['main_dir', '"""data"""'], {}), "(main_dir, 'data')\n", (204, 222), False, 'import os\n'), ((276, 304), 'os.path.join', 'os.path.join', (['data_dir', 'name'], {}), '(data_dir, name)\n', (288, 304), False, 'import os\n'), ((151, 176), 'os.path.abspath', 'os.path.abspath', ... |
#!/usr/bin/env python3
import os
def split_path(path):
parts = path.split('/')
if len(parts) > 0:
if parts[-1] == '':
parts.pop(-1)
return parts
def mkdirs(*parts):
path = os.path.join(*parts)
from .io import mkdirs
mkdirs(path)
return path
| [
"os.path.join"
] | [((211, 231), 'os.path.join', 'os.path.join', (['*parts'], {}), '(*parts)\n', (223, 231), False, 'import os\n')] |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# This file is covered by the LICENSE file in the root of this project.
from __future__ import annotations
import typing
import cv2
import numpy as np
class PiRandomTransform:
"""A transformation that can act on raster and sparse two-dimensional data."""
def ... | [
"numpy.clip",
"numpy.eye",
"cv2.warpAffine",
"numpy.ones",
"numpy.cos",
"cv2.cvtColor",
"numpy.sin",
"cv2.GaussianBlur",
"numpy.remainder"
] | [((4723, 4748), 'numpy.eye', 'np.eye', (['(3)'], {'dtype': 'np.float'}), '(3, dtype=np.float)\n', (4729, 4748), True, 'import numpy as np\n'), ((4879, 4904), 'numpy.eye', 'np.eye', (['(3)'], {'dtype': 'np.float'}), '(3, dtype=np.float)\n', (4885, 4904), True, 'import numpy as np\n'), ((5115, 5140), 'numpy.eye', 'np.eye... |
#!/usr/bin/python
import pandas as pd
import numpy as np
# code to gather together the code
# I am working from the CollegeSprint folder
import os
path = "/home/debasish/Desktop/CollegeSprint/Files"
file_list = sorted(os.listdir(path))
mainFrame = pd.DataFrame()
delcol = ['eob_id','batch_arrival_time','eob_plan_t... | [
"pandas.DataFrame",
"os.listdir",
"pandas.read_csv"
] | [((254, 268), 'pandas.DataFrame', 'pd.DataFrame', ([], {}), '()\n', (266, 268), True, 'import pandas as pd\n'), ((902, 937), 'pandas.read_csv', 'pd.read_csv', (['"""output.csv"""'], {'header': '(0)'}), "('output.csv', header=0)\n", (913, 937), True, 'import pandas as pd\n'), ((223, 239), 'os.listdir', 'os.listdir', (['... |
from django.db import models
from django.utils import timezone
from django.urls import reverse
from django.contrib.auth.models import User
from user_auth.choices import *
def upload_room_images(instance,filename):
return "Room/Images/{room}/{filename}/".format(room=instance.room,filename=filename)
def upload_co... | [
"django.db.models.TextField",
"django.db.models.ForeignKey",
"django.db.models.ImageField",
"django.db.models.BigIntegerField",
"django.urls.reverse",
"django.db.models.DateTimeField",
"django.db.models.CharField"
] | [((472, 521), 'django.db.models.ForeignKey', 'models.ForeignKey', (['User'], {'on_delete': 'models.CASCADE'}), '(User, on_delete=models.CASCADE)\n', (489, 521), False, 'from django.db import models\n'), ((534, 613), 'django.db.models.CharField', 'models.CharField', ([], {'choices': 'STATES_UNION_TERRITORIES', 'blank': ... |
import random
from .consts import ITEM_SLOT_ARMOR, ITEM_SLOT_WEAPON
from .utility import get_random_array_element
class Item:
weapon_list = {}
armor_list = {}
def __init__(self, level: int, slot: int):
if slot == ITEM_SLOT_WEAPON:
self.affix = get_random_array_element(Item.weapon_lis... | [
"random.random"
] | [((787, 802), 'random.random', 'random.random', ([], {}), '()\n', (800, 802), False, 'import random\n')] |
# Generated by Django 3.2.7 on 2021-12-13 15:25
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('order', '0001_initial'),
]
operations = [
migrations.AlterField(
model_name='order',
name='additional',
... | [
"django.db.models.TextField"
] | [((326, 353), 'django.db.models.TextField', 'models.TextField', ([], {'null': '(True)'}), '(null=True)\n', (342, 353), False, 'from django.db import migrations, models\n')] |
from copy import copy
from collections import defaultdict, namedtuple
with open("day22.in") as f:
# with open("day22.small.in") as f:
lines = f.read().splitlines()
reactor = defaultdict(bool)
for line in lines[:20]:
# on x=0..45,y=-21..27,z=-28..20
# print(line)
switch, coords = line.split()
x, ... | [
"collections.defaultdict"
] | [((180, 197), 'collections.defaultdict', 'defaultdict', (['bool'], {}), '(bool)\n', (191, 197), False, 'from collections import defaultdict, namedtuple\n')] |
# Generated by Django 3.1.7 on 2021-03-26 08:59
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='MuscleGroup',
fields=[
... | [
"django.db.models.TextField",
"django.db.models.AutoField",
"django.db.models.CharField",
"django.db.models.ForeignKey"
] | [((340, 433), 'django.db.models.AutoField', 'models.AutoField', ([], {'auto_created': '(True)', 'primary_key': '(True)', 'serialize': '(False)', 'verbose_name': '"""ID"""'}), "(auto_created=True, primary_key=True, serialize=False,\n verbose_name='ID')\n", (356, 433), False, 'from django.db import migrations, models\... |
from shaape.parser import Parser
import nose
import unittest
from nose.tools import *
class TestParser(unittest.TestCase):
def test_init(self):
parser = Parser()
assert parser != None
assert parser.parsed_data() == []
assert parser.drawable_objects() == []
def test_run(self):
... | [
"shaape.parser.Parser"
] | [((166, 174), 'shaape.parser.Parser', 'Parser', ([], {}), '()\n', (172, 174), False, 'from shaape.parser import Parser\n'), ((336, 344), 'shaape.parser.Parser', 'Parser', ([], {}), '()\n', (342, 344), False, 'from shaape.parser import Parser\n')] |
from django.contrib.auth.mixins import LoginRequiredMixin
from django.shortcuts import render, redirect
from .forms import *
from .models import *
from django.contrib import messages
# Create your views here.
from django.views import View
# def index(request):
# return render(request, 'product/create_product.html... | [
"django.shortcuts.render",
"django.shortcuts.redirect",
"django.contrib.messages.success"
] | [((864, 924), 'django.shortcuts.render', 'render', (['request', '"""product/create_product_category.html"""', 'ctx'], {}), "(request, 'product/create_product_category.html', ctx)\n", (870, 924), False, 'from django.shortcuts import render, redirect\n'), ((1282, 1333), 'django.shortcuts.render', 'render', (['request', '... |
from gensim.models import Word2Vec
from gensim.models.keyedvectors import KeyedVectors
import numpy as np
word_vectors = KeyedVectors.load_word2vec_format('../data/cn.skipgram.bin/cn.skipgram.bin', binary=True,
unicode_errors='ignore')
# 距离,越大表示越不相似
print(word_vectors.w... | [
"gensim.models.keyedvectors.KeyedVectors.load_word2vec_format"
] | [((122, 240), 'gensim.models.keyedvectors.KeyedVectors.load_word2vec_format', 'KeyedVectors.load_word2vec_format', (['"""../data/cn.skipgram.bin/cn.skipgram.bin"""'], {'binary': '(True)', 'unicode_errors': '"""ignore"""'}), "('../data/cn.skipgram.bin/cn.skipgram.bin',\n binary=True, unicode_errors='ignore')\n", (155... |
from selenium.webdriver.remote.webdriver import WebDriver
from actions.handlers import hello, corona
import re
regex = re.compile('^bleep blop')
def login(browser: WebDriver, username: str, pwd: str) -> WebDriver:
browser.get('https://mbasic.facebook.com/messages/')
browser.find_element_by_css_selector('#log... | [
"actions.handlers.hello.handle",
"actions.handlers.corona.handle",
"re.compile"
] | [((120, 145), 're.compile', 're.compile', (['"""^bleep blop"""'], {}), "('^bleep blop')\n", (130, 145), False, 'import re\n'), ((1489, 1528), 'actions.handlers.hello.handle', 'hello.handle', (['_send_message', 'input_text'], {}), '(_send_message, input_text)\n', (1501, 1528), False, 'from actions.handlers import hello,... |
########
# Copyright (c) 2014 GigaSpaces Technologies Ltd. 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... | [
"argparse.ArgumentParser",
"cloudify.workflows.local.FileStorage",
"cloudify.workflows.local.load_env",
"cloudify.workflows.local.init_env",
"cloudify_rest_client.CloudifyClient"
] | [((792, 817), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (815, 817), False, 'import argparse\n'), ((1276, 1311), 'cloudify.workflows.local.FileStorage', 'local.FileStorage', (['args.storage_dir'], {}), '(args.storage_dir)\n', (1293, 1311), False, 'from cloudify.workflows import local\n'), (... |
import sys
def inline_validate_1(s):
from valid8 import validate
validate('s', s, instance_of=str, min_len=1)
validate('s', s, equals=s.lower())
def inline_validate_2(s):
from valid8 import validate
validate('s', s, instance_of=str, min_len=1, custom=str.islower)
def inline_validate_3(s):
... | [
"valid8.validator",
"valid8.validate",
"mini_lambda.s.islower",
"valid8.validation_lib.minlen",
"mini_lambda.s.lower",
"mini_lambda.Len",
"valid8.validation_lib.instance_of",
"mini_lambda.InputVar"
] | [((75, 119), 'valid8.validate', 'validate', (['"""s"""', 's'], {'instance_of': 'str', 'min_len': '(1)'}), "('s', s, instance_of=str, min_len=1)\n", (83, 119), False, 'from valid8 import validate\n'), ((223, 287), 'valid8.validate', 'validate', (['"""s"""', 's'], {'instance_of': 'str', 'min_len': '(1)', 'custom': 'str.i... |
import os
import pandas as pd
import data
import make_fingerprint as mf
def test_load_logfile():
# given
trace_file_name = "test/data/filtering_test.txt"
#must_include_head = ["POSI;", "WIFI;", "MAGN;"]
must_include_head = ["POSI;", "WIFI;"]
# when
filtered_lines = mf.load_logfile(trace_file_... | [
"make_fingerprint.load_logfile",
"make_fingerprint.fill_latitude_longitude",
"make_fingerprint.bind_wifi_fingerprints",
"data.load_from_json_file",
"pandas.read_csv",
"os.path.isfile",
"data.save_fingerprint_as_csv",
"make_fingerprint.bucketization",
"os.remove"
] | [((293, 344), 'make_fingerprint.load_logfile', 'mf.load_logfile', (['trace_file_name', 'must_include_head'], {}), '(trace_file_name, must_include_head)\n', (308, 344), True, 'import make_fingerprint as mf\n'), ((613, 664), 'make_fingerprint.load_logfile', 'mf.load_logfile', (['trace_file_name', 'must_include_head'], {}... |
from __future__ import print_function
import tikzplots as tkz
import argparse
import numpy as np
import re
def parse_data_file(fname):
with open(fname, 'r') as fp:
lines = fp.readlines()
# Read in the first line, and find the comma-separated values
# in the header
hline = lines[0]
... | [
"numpy.ceil",
"numpy.log10",
"tikzplots.get_legend_entry",
"argparse.ArgumentParser",
"tikzplots.get_2d_plot",
"numpy.max",
"tikzplots.get_2d_axes",
"numpy.array",
"numpy.linspace",
"tikzplots.get_end_tikz",
"tikzplots.get_begin_tikz",
"numpy.min",
"tikzplots.get_header"
] | [((861, 886), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (884, 886), False, 'import argparse\n'), ((2602, 2642), 'numpy.linspace', 'np.linspace', (['xmin', 'xmax', '(xmax - xmin + 1)'], {}), '(xmin, xmax, xmax - xmin + 1)\n', (2613, 2642), True, 'import numpy as np\n'), ((3535, 3551), 'tikz... |
import tensorflow as tf
import numpy as np
import os
class TFModel(object):
'''
This class contains the general functions for a tensorflow model
'''
def __init__(self, config):
# Limit the TensorFlow's logs
#os.environ['TF_CPP_MIN_LOG_LEVEL'] = '4'
# tf.logging.set_verbosi... | [
"os.path.exists",
"numpy.savez",
"tensorflow.reset_default_graph",
"os.makedirs",
"tensorflow.Session",
"tensorflow.train.Saver",
"tensorflow.global_variables_initializer",
"tensorflow.ConfigProto"
] | [((847, 916), 'tensorflow.ConfigProto', 'tf.ConfigProto', ([], {'allow_soft_placement': '(True)', 'log_device_placement': '(False)'}), '(allow_soft_placement=True, log_device_placement=False)\n', (861, 916), True, 'import tensorflow as tf\n'), ((1022, 1050), 'tensorflow.Session', 'tf.Session', ([], {'config': 'sess_con... |
from flask import Flask, request, jsonify
app = Flask(__name__)
@app.route('/upload', methods=['POST'])
def index():
image_files = request.files.getlist('image')
video_files = request.files.getlist('video')
if not image_files and not video_files:
return jsonify({
"code": -1,
... | [
"flask.jsonify",
"flask.request.files.getlist",
"flask.Flask"
] | [((49, 64), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (54, 64), False, 'from flask import Flask, request, jsonify\n'), ((138, 168), 'flask.request.files.getlist', 'request.files.getlist', (['"""image"""'], {}), "('image')\n", (159, 168), False, 'from flask import Flask, request, jsonify\n'), ((187, 21... |
import logging
from dataclasses import dataclass
from unittest.mock import patch
import pytest
from tests.utils.mock_backend import (
ApiKey,
BackendContext,
Run,
Project,
Team,
User,
)
from tests.utils.mock_base_client import MockBaseClient
###################################... | [
"tests.utils.mock_backend.Team",
"tests.utils.mock_backend.User",
"logging.info",
"tests.utils.mock_backend.Project",
"pytest.fixture",
"unittest.mock.patch",
"tests.utils.mock_backend.ApiKey",
"tests.utils.mock_backend.Run",
"tests.utils.mock_backend.BackendContext"
] | [((541, 572), 'pytest.fixture', 'pytest.fixture', ([], {'scope': '"""session"""'}), "(scope='session')\n", (555, 572), False, 'import pytest\n'), ((898, 944), 'pytest.fixture', 'pytest.fixture', ([], {'scope': '"""function"""', 'autouse': '(True)'}), "(scope='function', autouse=True)\n", (912, 944), False, 'import pyte... |
"""
Run this class to save the 3D face tracking pipeline into a folder.
"""
import cv2
import os
import time
import utils
import face_alignment as fa
import face_detection as fd
import face_fit as ff
input_folder = './data/source/' # The input images path.
output_folder = './data/results/' # The output images path.
... | [
"face_detection.crop_faces",
"os.path.exists",
"cv2.imwrite",
"os.listdir",
"os.makedirs",
"face_fit.fit_3dmm",
"utils.landmarks_to_np_array",
"cv2.findHomography",
"utils.create_transparent_overlay_faster",
"cv2.warpPerspective",
"time.time",
"face_alignment.predict_pose",
"face_detection.r... | [((402, 426), 'os.listdir', 'os.listdir', (['input_folder'], {}), '(input_folder)\n', (412, 426), False, 'import os\n'), ((327, 356), 'os.path.exists', 'os.path.exists', (['output_folder'], {}), '(output_folder)\n', (341, 356), False, 'import os\n'), ((362, 388), 'os.makedirs', 'os.makedirs', (['output_folder'], {}), '... |
from tornado import websocket, web, ioloop
import json
streamers = []
streamees = dict()
streamees_check = []
image = str()
class StreamerHandler(websocket.WebSocketHandler):
def open(self, ws_id):
self.ws_id = ws_id
global streamers
if self not in streamers:
streamers.appen... | [
"tornado.ioloop.IOLoop.instance",
"tornado.web.Application"
] | [((1276, 1342), 'tornado.web.Application', 'web.Application', (["[('/streamer/(.*)', StreamerHandler)]"], {}), "([('/streamer/(.*)', StreamerHandler)], **settings)\n", (1291, 1342), False, 'from tornado import websocket, web, ioloop\n'), ((1366, 1432), 'tornado.web.Application', 'web.Application', (["[('/streamee/(.*)'... |
import os
from astropy.io import ascii
import initialize_mosdef_dirs as imd
import matplotlib.pyplot as plt
def plot_scaled_composites(n_clusters):
"""Using the scaling that was done above, plot the scaled composite seds
Parameters:
n_clusters (int): Number of clusters
"""
fig, ax = plt.sub... | [
"astropy.io.ascii.read",
"os.listdir",
"matplotlib.pyplot.subplots"
] | [((313, 341), 'matplotlib.pyplot.subplots', 'plt.subplots', ([], {'figsize': '(8, 7)'}), '(figsize=(8, 7))\n', (325, 341), True, 'import matplotlib.pyplot as plt\n'), ((398, 460), 'astropy.io.ascii.read', 'ascii.read', (["(imd.composite_sed_csvs_dir + f'/{groupID}_sed.csv')"], {}), "(imd.composite_sed_csvs_dir + f'/{gr... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models
from shop.models import Product
from accounts.models import User
class Cart(models.Model):
user = models.OneToOneField(User, on_delete=models.CASCADE, null=True)
created = models.DateTimeField(auto_now_add=True)
... | [
"django.db.models.OneToOneField",
"django.db.models.ForeignKey",
"django.db.models.BooleanField",
"django.db.models.PositiveIntegerField",
"django.db.models.DateTimeField",
"django.db.models.DecimalField"
] | [((198, 261), 'django.db.models.OneToOneField', 'models.OneToOneField', (['User'], {'on_delete': 'models.CASCADE', 'null': '(True)'}), '(User, on_delete=models.CASCADE, null=True)\n', (218, 261), False, 'from django.db import models\n'), ((276, 315), 'django.db.models.DateTimeField', 'models.DateTimeField', ([], {'auto... |
#!/usr/bin/env python3
# encoding: utf-8
"""
tuya-discovery.py
Created by kueblc on 2019-11-13.
Discover Tuya devices on the LAN via UDP broadcast
"""
import asyncio
import json
from Crypto.Cipher import AES
pad = lambda s: s + (16 - len(s) % 16) * chr(16 - len(s) % 16)
unpad = lambda s: s[:-ord(s[len(s) - 1:])]
encr... | [
"json.loads",
"asyncio.get_event_loop",
"Crypto.Cipher.AES.new",
"hashlib.md5"
] | [((902, 926), 'asyncio.get_event_loop', 'asyncio.get_event_loop', ([], {}), '()\n', (924, 926), False, 'import asyncio\n'), ((496, 520), 'hashlib.md5', 'md5', (["b'yGAdlopoPVldABfn'"], {}), "(b'yGAdlopoPVldABfn')\n", (499, 520), False, 'from hashlib import md5\n'), ((343, 369), 'Crypto.Cipher.AES.new', 'AES.new', (['ke... |
import tensorflow as tf
import numpy as np
from interfaces import AbstractSelfAdaptingStrategy
def _get_category_encoding_layer(size):
return lambda feature: tf.one_hot(feature, size + 1) # +1 since classes are labeled from 1
def _prepare_inputs():
all_inputs = tf.keras.Input(shape=(2,), dtype='int32')
... | [
"tensorflow.one_hot",
"tensorflow.losses.Poisson",
"tensorflow.config.threading.set_intra_op_parallelism_threads",
"tensorflow.keras.layers.Concatenate",
"tensorflow.convert_to_tensor",
"numpy.array",
"tensorflow.keras.experimental.CosineDecay",
"tensorflow.keras.layers.Dense",
"tensorflow.config.th... | [((275, 316), 'tensorflow.keras.Input', 'tf.keras.Input', ([], {'shape': '(2,)', 'dtype': '"""int32"""'}), "(shape=(2,), dtype='int32')\n", (289, 316), True, 'import tensorflow as tf\n'), ((1006, 1055), 'tensorflow.keras.Model', 'tf.keras.Model', ([], {'inputs': 'all_inputs', 'outputs': 'output'}), '(inputs=all_inputs,... |
# Generated by Django 2.2.7 on 2020-01-04 23:10
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('MainProject', '0023_auto_20200105_0203'),
]
operations = [
migrations.AddField(
model_name='coursematerial',
name='d... | [
"django.db.migrations.DeleteModel",
"django.db.models.FileField"
] | [((420, 469), 'django.db.migrations.DeleteModel', 'migrations.DeleteModel', ([], {'name': '"""CourseMaterialFile"""'}), "(name='CourseMaterialFile')\n", (442, 469), False, 'from django.db import migrations, models\n'), ((348, 399), 'django.db.models.FileField', 'models.FileField', ([], {'null': '(True)', 'upload_to': '... |
#! /usr/bin/env python
# -*- coding: UTF-8 -*-
from __future__ import division, print_function
from Bio import SeqIO
import sys
getName = lambda x : x if "_" not in x else x[:x.rfind("_")]
data = {}
with open(sys.argv[1], "r") as inF:
for record in SeqIO.parse(inF, "fasta"):
fullName = record.name
... | [
"Bio.SeqIO.parse"
] | [((256, 281), 'Bio.SeqIO.parse', 'SeqIO.parse', (['inF', '"""fasta"""'], {}), "(inF, 'fasta')\n", (267, 281), False, 'from Bio import SeqIO\n')] |
import codecs
import importlib
import logging
import os
import sys
import time
import html
import accounts
import config
import log
import storage
from args import args
from vkapi import VkApi
from vkbot import createVkApi
from scripts import runScript, runInMaster
os.chdir(os.path.dirname(os.path.realpath(sys.argv[... | [
"logging.getLogger",
"log.warning",
"os.listdir",
"config.get",
"log.error",
"codecs.getwriter",
"accounts.init",
"log.info",
"logging.warning",
"sys.stdout.detach",
"os.path.realpath",
"log.debug",
"vkbot.createVkApi",
"os.getpid",
"sys.exit",
"html.escape",
"accounts.getFile"
] | [((326, 341), 'accounts.init', 'accounts.init', ([], {}), '()\n', (339, 341), False, 'import accounts\n'), ((1387, 1432), 'config.get', 'config.get', (['"""vkbot.suppress_chat_stderr"""', '"""b"""'], {}), "('vkbot.suppress_chat_stderr', 'b')\n", (1397, 1432), False, 'import config\n'), ((1630, 1655), 'config.get', 'con... |
from django.db import transaction
from api.management.data_script import OperationalDataScript
from api.models.signing_authority_assertion import SigningAuthorityAssertion
class UpdateSigningAuthorityAssertions(OperationalDataScript):
"""
Update the assertions for the compliance report
"""
is_reverta... | [
"api.models.signing_authority_assertion.SigningAuthorityAssertion.objects.get"
] | [((598, 660), 'api.models.signing_authority_assertion.SigningAuthorityAssertion.objects.get', 'SigningAuthorityAssertion.objects.get', ([], {'module': '"""consumer_sales"""'}), "(module='consumer_sales')\n", (635, 660), False, 'from api.models.signing_authority_assertion import SigningAuthorityAssertion\n')] |
# -*- coding: utf-8 -*-
import numpy as np
# Note: careful as np.multiply does an elementwise multiply on numpy arrays
# asterisk (*) does the same but will perfom matrix multiplication on mat (numpy matrices)
class L1Regularization:
"""
**Lasso Regression (L1Regularization)**
L1Regularization ad... | [
"numpy.multiply",
"numpy.sign",
"numpy.linalg.norm"
] | [((2270, 2304), 'numpy.multiply', 'np.multiply', (['self._lambda', 'weights'], {}), '(self._lambda, weights)\n', (2281, 2304), True, 'import numpy as np\n'), ((1102, 1125), 'numpy.linalg.norm', 'np.linalg.norm', (['weights'], {}), '(weights)\n', (1116, 1125), True, 'import numpy as np\n'), ((1204, 1220), 'numpy.sign', ... |
#!/usr/bin/env python3
import rclpy
from rclpy.node import Node
from rclpy.callback_groups import ReentrantCallbackGroup
from rclpy.clock import Duration
from rclpy.executors import MultiThreadedExecutor
from geometry_msgs.msg import PoseStamped, Point
from mavros_msgs.srv import CommandBool, SetMode
from mavros_msgs... | [
"rclpy.ok",
"rclpy.executors.MultiThreadedExecutor",
"mavros_msgs.msg.State",
"mavros_msgs.srv.CommandBool.Request",
"rclpy.clock.Duration",
"mavros_msgs.srv.SetMode.Request",
"geometry_msgs.msg.Point",
"geometry_msgs.msg.PoseStamped",
"rclpy.spin_once",
"rclpy.init"
] | [((833, 854), 'rclpy.init', 'rclpy.init', ([], {'args': 'args'}), '(args=args)\n', (843, 854), False, 'import rclpy\n'), ((894, 917), 'rclpy.executors.MultiThreadedExecutor', 'MultiThreadedExecutor', ([], {}), '()\n', (915, 917), False, 'from rclpy.executors import MultiThreadedExecutor\n'), ((1317, 1330), 'geometry_ms... |
#!/home/ssericksen/anaconda2/bin/python2.7
# evaluate F1 and MCC metrics on new targets. Assume 10% hit fractions,
# and predict top 10% of cpds by score as the actives
import numpy as np
import pandas as pd
import informer_functions as inf
import sklearn as sk
import sys
try:
matrix = sys.argv[1] # 1 or 2
t... | [
"sklearn.metrics.f1_score",
"pandas.read_csv",
"pandas.concat",
"informer_functions.get_binary",
"sklearn.metrics.matthews_corrcoef"
] | [((717, 769), 'pandas.read_csv', 'pd.read_csv', (['activity_matrix_file'], {'index_col': '"""molid"""'}), "(activity_matrix_file, index_col='molid')\n", (728, 769), True, 'import pandas as pd\n'), ((783, 812), 'informer_functions.get_binary', 'inf.get_binary', (['df_continuous'], {}), '(df_continuous)\n', (797, 812), T... |
"""
Ref: https://github.com/htwang14/CAT/blob/1152f7095d6ea0026c7344b00fefb9f4990444f2/models/FiLM.py#L35
"""
import numpy as np
import torch.nn as nn
from torch.nn import functional as F
from torch.nn.modules.batchnorm import _BatchNorm
class SwitchableLayer1D(nn.Module):
"""1-dimensional switchable layer.
T... | [
"torch.nn.functional.linear",
"torch.nn.functional.conv2d",
"numpy.ceil",
"torch.nn.ModuleList",
"torch.nn.functional.batch_norm"
] | [((961, 983), 'torch.nn.ModuleList', 'nn.ModuleList', (['modules'], {}), '(modules)\n', (974, 983), True, 'import torch.nn as nn\n'), ((6404, 6656), 'torch.nn.functional.batch_norm', 'F.batch_norm', (['input', '(self.running_mean if not self.training or self.track_running_stats else None)', '(self.running_var if not se... |
"""
renameHeaders.py
Created by <NAME>
Before a hybrid index can be created from hg19_random.fa and
mm10.fa, the headers must be changed so that they are reference-specific.
This is important during the alignment process, as the name of the chromosome to which
each read aligns is included in the SAM format for that r... | [
"re.findall"
] | [((629, 668), 're.findall', 're.findall', (['""">chr[0-9]*"""', 'line'], {'flags': '(0)'}), "('>chr[0-9]*', line, flags=0)\n", (639, 668), False, 'import re\n')] |
import unittest
from rapidmaps.map.state import MapStateType, MapStateEntity, MapState, MapStateTranslator
from rapidmaps.map.selection import Selections
from rapidmaps.map.shape import Point
import wx
class MyTestCase(unittest.TestCase):
def test_map_sate_type(self):
self.assertEqual(MapStateType.conta... | [
"rapidmaps.map.state.MapStateType.contains",
"rapidmaps.map.selection.Selections",
"rapidmaps.map.state.MapState",
"rapidmaps.map.state.MapStateTranslator",
"rapidmaps.map.state.MapStateEntity",
"rapidmaps.map.state.MapStateType.get_default",
"unittest.main",
"wx.Point",
"rapidmaps.map.shape.Point"
... | [((2689, 2704), 'unittest.main', 'unittest.main', ([], {}), '()\n', (2702, 2704), False, 'import unittest\n'), ((713, 752), 'rapidmaps.map.state.MapStateEntity', 'MapStateEntity', (['MapStateType.UNKNOWN', '(2)'], {}), '(MapStateType.UNKNOWN, 2)\n', (727, 752), False, 'from rapidmaps.map.state import MapStateType, MapS... |
#!/usr/bin/python3
import argparse
from huepy import *
import sys
import importlib
import os
import base64
import pyperclip
import subprocess
from terminaltables import SingleTable
import random
import socket
#import atexit
POXSSON_PATH = os.path.realpath(__file__).replace("poxsson.py", "") #Absolute path of the projec... | [
"random.choice",
"importlib.import_module",
"argparse.ArgumentParser",
"socket.socket",
"terminaltables.SingleTable",
"random.randrange",
"os.path.realpath",
"pyperclip.copy",
"subprocess.call",
"sys.exit",
"os.walk"
] | [((1741, 1789), 'socket.socket', 'socket.socket', (['socket.AF_INET', 'socket.SOCK_DGRAM'], {}), '(socket.AF_INET, socket.SOCK_DGRAM)\n', (1754, 1789), False, 'import socket\n'), ((2894, 2917), 'terminaltables.SingleTable', 'SingleTable', (['table_data'], {}), '(table_data)\n', (2905, 2917), False, 'from terminaltables... |
# -*- coding: utf-8 -*-
from flask import Flask
from flask import render_template
from flask import request
from flask import make_response
import pandas as pd
import numpy as np
import csv
import io
app = Flask(__name__)
@app.route("/")
def index():
return render_template("index.html")
DATA = pd.read_csv("Exp... | [
"flask.render_template",
"pandas.read_csv",
"io.StringIO.StringIO",
"flask.Flask",
"csv.writer"
] | [((207, 222), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (212, 222), False, 'from flask import Flask\n'), ((304, 355), 'pandas.read_csv', 'pd.read_csv', (['"""Export_Deepki_Ready_dae.csv"""'], {'sep': '""","""'}), "('Export_Deepki_Ready_dae.csv', sep=',')\n", (315, 355), True, 'import pandas as pd\n'),... |
# -*- coding: utf-8 -*-
# # Code from page 179
class Toy(object):
def __init__(self):
self._elems = []
def add(self, new_elems):
"""new_elems is a list"""
self._elems += new_elems
def size(self):
return len(self._elems)
# print(type(Toy))
# print(type(Toy.__init__), type(To... | [
"datetime.date.today"
] | [((4324, 4345), 'datetime.date.today', 'datetime.date.today', ([], {}), '()\n', (4343, 4345), False, 'import datetime\n')] |
"""
组合模式
"""
from DataStructure.Link import FavoritesList
if __name__ == '__main__':
_favorites_list = FavoritesList()
| [
"DataStructure.Link.FavoritesList"
] | [((109, 124), 'DataStructure.Link.FavoritesList', 'FavoritesList', ([], {}), '()\n', (122, 124), False, 'from DataStructure.Link import FavoritesList\n')] |
import adwords_pull
import analytics_pull
import process_xml
import match_maker
import csv_parser
import pandas
import pandasql
import datetime
import google_auth
from google.cloud import bigquery
from datetime import date
from dateutil.relativedelta import relativedelta, SU,MO,TU,WE,TH,FR,SA
import pprint
from currenc... | [
"google_auth.getCreds",
"csv_parser.parseToCSV",
"adwords_pull.ProductDecline",
"match_maker.CheckDateFormatAnalytics",
"dateutil.relativedelta.WE",
"dateutil.relativedelta.TH",
"dateutil.relativedelta.MO",
"dateutil.relativedelta.SU",
"match_maker.ApplyYear",
"dateutil.relativedelta.FR",
"dateu... | [((496, 515), 'currency_converter.CurrencyConverter', 'CurrencyConverter', ([], {}), '()\n', (513, 515), False, 'from currency_converter import CurrencyConverter\n'), ((927, 976), 'adwords_pull.ProductDecline', 'adwords_pull.ProductDecline', (['START_DATE', 'END_DATE'], {}), '(START_DATE, END_DATE)\n', (954, 976), Fals... |
from fastapi import APIRouter, Depends, HTTPException, Response, status
from fastapi.security import OAuth2PasswordRequestForm
from pydantic import BaseModel
from fastapi_users import models
from fastapi_users.authentication import Authenticator, BaseAuthentication
from fastapi_users.manager import BaseUserManager, Us... | [
"fastapi.HTTPException",
"fastapi.APIRouter",
"fastapi.Depends"
] | [((884, 895), 'fastapi.APIRouter', 'APIRouter', ([], {}), '()\n', (893, 895), False, 'from fastapi import APIRouter, Depends, HTTPException, Response, status\n'), ((2022, 2031), 'fastapi.Depends', 'Depends', ([], {}), '()\n', (2029, 2031), False, 'from fastapi import APIRouter, Depends, HTTPException, Response, status\... |
import time
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
import collections
import os
def Clear_Empty_Lines(text):
# Read lines as a list
fh = open(text, "r")
lines = fh.readlines()
fh.close()
# Clear empty lines
lines = filter(lambda x: not x... | [
"os.path.isfile",
"selenium.webdriver.Chrome",
"time.sleep"
] | [((1636, 1667), 'os.path.isfile', 'os.path.isfile', (['video_file_name'], {}), '(video_file_name)\n', (1650, 1667), False, 'import os\n'), ((540, 558), 'selenium.webdriver.Chrome', 'webdriver.Chrome', ([], {}), '()\n', (556, 558), False, 'from selenium import webdriver\n'), ((910, 923), 'time.sleep', 'time.sleep', (['(... |
import datetime
from django.utils.timezone import now
from django.db.utils import IntegrityError
from django.db import transaction
from .models import Lock
def clear_expired_locks():
now_time = now()
with transaction.atomic():
Lock.objects.filter(expire_time__lte=now_time).delete()
def acquire_lock(... | [
"django.utils.timezone.now",
"datetime.timedelta",
"django.db.transaction.atomic"
] | [((200, 205), 'django.utils.timezone.now', 'now', ([], {}), '()\n', (203, 205), False, 'from django.utils.timezone import now\n'), ((485, 490), 'django.utils.timezone.now', 'now', ([], {}), '()\n', (488, 490), False, 'from django.utils.timezone import now\n'), ((215, 235), 'django.db.transaction.atomic', 'transaction.a... |
import os
from argparse import RawTextHelpFormatter, ArgumentTypeError, ArgumentParser
from cfg_exporter.const import ExportType, ExtensionType, TEMPLATE_EXTENSION
def valid_source(source):
if os.path.exists(source):
return source
else:
raise ArgumentTypeError(_('the source path does not exis... | [
"os.path.exists",
"cfg_exporter.const.ExportType.__members__.keys",
"cfg_exporter.const.ExtensionType.__members__.keys"
] | [((200, 222), 'os.path.exists', 'os.path.exists', (['source'], {}), '(source)\n', (214, 222), False, 'import os\n'), ((884, 913), 'os.path.exists', 'os.path.exists', (['lang_template'], {}), '(lang_template)\n', (898, 913), False, 'import os\n'), ((1688, 1717), 'cfg_exporter.const.ExportType.__members__.keys', 'ExportT... |
from unittest import TestCase
import vivino.data.geojson.serialiser as ser
from vivino.data.model.winery import Winery
from shapely_geojson import Feature
from shapely.geometry import Point
import json
class TestSerialiser(TestCase):
def test_serialise(self):
serialised = ser.serialise(Winery("<NAM... | [
"json.loads",
"vivino.data.model.winery.Winery"
] | [((372, 394), 'json.loads', 'json.loads', (['serialised'], {}), '(serialised)\n', (382, 394), False, 'import json\n'), ((308, 351), 'vivino.data.model.winery.Winery', 'Winery', (['"""<NAME>"""', '(17.0118954)', '(45.5643442)', '(2)'], {}), "('<NAME>', 17.0118954, 45.5643442, 2)\n", (314, 351), False, 'from vivino.data.... |
#!/usr/bin/env python
# coding: utf-8
# In[2]:
# import matplotlib.pyplot as plt
# from scipy import interpolate
import numpy as np
# step = np.array([12, 6, 4, 3, 2])
# MAP5 = np.array([0.6480, 0.6797, 0.6898, 0.6921, 0.6982])
# step_new = np.arange(step.min(), step.max(), 0.1)
# # step_new = n... | [
"numpy.mean"
] | [((1794, 1808), 'numpy.mean', 'np.mean', (['diffs'], {}), '(diffs)\n', (1801, 1808), True, 'import numpy as np\n'), ((1834, 1846), 'numpy.mean', 'np.mean', (['mvs'], {}), '(mvs)\n', (1841, 1846), True, 'import numpy as np\n'), ((1874, 1888), 'numpy.mean', 'np.mean', (['flows'], {}), '(flows)\n', (1881, 1888), True, 'im... |
from django.shortcuts import render, redirect
from django.conf import settings
from django.http import JsonResponse
from django.core.mail import BadHeaderError, EmailMessage
from django.template.loader import get_template
from django.http import HttpResponse, HttpResponseForbidden, HttpResponseServerError, HttpResponse... | [
"django.shortcuts.render",
"django.http.JsonResponse",
"django.http.HttpResponse",
"django.http.HttpResponseForbidden",
"requests.get",
"ipaddress.ip_network",
"django.utils.encoding.force_bytes",
"django.shortcuts.redirect",
"django.http.HttpResponseServerError",
"django.core.mail.EmailMessage",
... | [((836, 880), 'django.shortcuts.render', 'render', (['request', '"""olora_frontend/index.html"""'], {}), "(request, 'olora_frontend/index.html')\n", (842, 880), False, 'from django.shortcuts import render, redirect\n'), ((914, 961), 'django.shortcuts.render', 'render', (['request', '"""olora_frontend/index.kn.html"""']... |
from django.shortcuts import render , get_object_or_404, redirect
from django.http import HttpResponse
from .models import About
from django.contrib import messages
from django.views.generic import ListView, DetailView
from django.utils import timezone
from .models import (
Item, Order, OrderItem
)
# Create your views ... | [
"django.shortcuts.render",
"django.shortcuts.get_object_or_404",
"django.contrib.messages.info",
"django.utils.timezone.now",
"django.shortcuts.redirect"
] | [((356, 416), 'django.shortcuts.render', 'render', (['request', '"""../templates/home.html"""', "{'title': 'Home'}"], {}), "(request, '../templates/home.html', {'title': 'Home'})\n", (362, 416), False, 'from django.shortcuts import render, get_object_or_404, redirect\n'), ((449, 511), 'django.shortcuts.render', 'render... |
from __future__ import print_function
from expresso.libs.expresso_serial import ExpressoSerial
import sys
port = sys.argv[1]
number = int(sys.argv[2])
print()
print('setting device ID')
print(' port = {0}'.format(port))
print(' number = {0}'.format(number))
print()
dev = ExpressoSerial(port,checkId=False)
dev.... | [
"expresso.libs.expresso_serial.ExpressoSerial"
] | [((281, 316), 'expresso.libs.expresso_serial.ExpressoSerial', 'ExpressoSerial', (['port'], {'checkId': '(False)'}), '(port, checkId=False)\n', (295, 316), False, 'from expresso.libs.expresso_serial import ExpressoSerial\n')] |
from Crypto.Cipher import AES
from Crypto.PublicKey import ECC
from Crypto.Math.Numbers import Integer
import os
import hashlib
def ecc_point_to_256_bit_key(point):
sha = hashlib.sha256(point.x.to_bytes())
sha.update(point.y.to_bytes())
return sha.digest()
def ecc_encrypt(plain_text, ecc_public_key):
... | [
"Crypto.PublicKey.ECC.generate",
"Crypto.Cipher.AES.new",
"Crypto.PublicKey.ECC.import_key"
] | [((985, 1012), 'Crypto.PublicKey.ECC.generate', 'ECC.generate', ([], {'curve': '"""P-256"""'}), "(curve='P-256')\n", (997, 1012), False, 'from Crypto.PublicKey import ECC\n'), ((338, 365), 'Crypto.PublicKey.ECC.generate', 'ECC.generate', ([], {'curve': '"""P-256"""'}), "(curve='P-256')\n", (350, 365), False, 'from Cryp... |
from tornado import ioloop
import time
import requests
import sys
import requests
import re
s = time.time()
maxRequestCount = 1000000000
i = 0
c = 0
# Takes destination ip as command line input
if len(sys.argv) > 1:
if re.match("^http", sys.argv[1]):
ip = sys.argv[1]
else:
ip = "http://" + sy... | [
"re.match",
"time.sleep",
"requests.get",
"tornado.ioloop.IOLoop.instance",
"time.time"
] | [((97, 108), 'time.time', 'time.time', ([], {}), '()\n', (106, 108), False, 'import time\n'), ((226, 256), 're.match', 're.match', (['"""^http"""', 'sys.argv[1]'], {}), "('^http', sys.argv[1])\n", (234, 256), False, 'import re\n'), ((813, 829), 'requests.get', 'requests.get', (['ip'], {}), '(ip)\n', (825, 829), False, ... |
# -*- coding: utf-8 -*-
# website: https://loovien.github.io
# author: luowen<<EMAIL>>
# time: 2018/9/29 21:41
# desc:
from typing import List
from pathlib import Path
import shutil
from json import dump
import logging
from datetime import datetime
logger = logging.getLogger(__name__)
def videos_export_json(data: L... | [
"logging.getLogger",
"datetime.datetime.now",
"json.dump",
"pathlib.Path"
] | [((260, 287), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (277, 287), False, 'import logging\n'), ((427, 439), 'pathlib.Path', 'Path', (['output'], {}), '(output)\n', (431, 439), False, 'from pathlib import Path\n'), ((802, 849), 'json.dump', 'dump', (['data', 'fd'], {'indent': '""" "... |
import pytest
from eshop.order import Order
@pytest.fixture
def jan_order() -> Order:
return Order(client_first_name="Jan", client_last_name="Nowak")
@pytest.fixture
def other_jan_order() -> Order:
return Order(client_first_name="Jan", client_last_name="Nowak")
def test_add_element(jan_order):
jan_or... | [
"eshop.order.Order"
] | [((100, 156), 'eshop.order.Order', 'Order', ([], {'client_first_name': '"""Jan"""', 'client_last_name': '"""Nowak"""'}), "(client_first_name='Jan', client_last_name='Nowak')\n", (105, 156), False, 'from eshop.order import Order\n'), ((218, 274), 'eshop.order.Order', 'Order', ([], {'client_first_name': '"""Jan"""', 'cli... |
"""
Unit test use of Path
"""
from pathlib_plus.pathlib_plus import Path
from os.path import expandvars
import unittest
test_base = Path(expandvars(r'%temp%'))
test_folder = Path(r'Program Files(x86)\Steam\steamapps\common\rFactor 2')
DUMMY_FOLDERS = [
r'Installed\Locations\3pa_bathurst_2014',
r'Installed\Loc... | [
"pathlib_plus.pathlib_plus.Path",
"os.path.expandvars",
"unittest.main"
] | [((175, 238), 'pathlib_plus.pathlib_plus.Path', 'Path', (['"""Program Files(x86)\\\\Steam\\\\steamapps\\\\common\\\\rFactor 2"""'], {}), "('Program Files(x86)\\\\Steam\\\\steamapps\\\\common\\\\rFactor 2')\n", (179, 238), False, 'from pathlib_plus.pathlib_plus import Path\n'), ((138, 158), 'os.path.expandvars', 'expand... |
# Copyright (c) 2010 Google Inc. All rights reserved.
# Use of this source code is governed by a Apache-style license that can be
# found in the LICENSE file.
from google.appengine.ext import db
import base
class FeaturedGame(db.Model):
reference = db.ReferenceProperty(base.Game)
class PopularGame(db.Model):
r... | [
"google.appengine.ext.db.ReferenceProperty"
] | [((255, 286), 'google.appengine.ext.db.ReferenceProperty', 'db.ReferenceProperty', (['base.Game'], {}), '(base.Game)\n', (275, 286), False, 'from google.appengine.ext import db\n'), ((331, 362), 'google.appengine.ext.db.ReferenceProperty', 'db.ReferenceProperty', (['base.Game'], {}), '(base.Game)\n', (351, 362), False,... |
import cv2
import numpy as np
thres = 0.45
nms_threshold = 0.2
#Default Camera Capture
cap = cv2.VideoCapture(0)
cap.set(3, 1280)
cap.set(4, 720)
cap.set(10, 150)
##Importing the COCO dataset in a list
classNames= []
classFile = 'coco.names'
with open(classFile,'rt') as f:
classNames = f.read().rstrip('\n').spli... | [
"cv2.rectangle",
"cv2.imshow",
"numpy.array",
"cv2.dnn_DetectionModel",
"cv2.destroyAllWindows",
"cv2.VideoCapture",
"cv2.dnn.NMSBoxes",
"cv2.waitKey"
] | [((95, 114), 'cv2.VideoCapture', 'cv2.VideoCapture', (['(0)'], {}), '(0)\n', (111, 114), False, 'import cv2\n'), ((522, 569), 'cv2.dnn_DetectionModel', 'cv2.dnn_DetectionModel', (['weightsPath', 'configPath'], {}), '(weightsPath, configPath)\n', (544, 569), False, 'import cv2\n'), ((1444, 1467), 'cv2.destroyAllWindows'... |
# Author: @Corefinder
# Language: Python
# Copyrights: SoumyajitBasu
# Purpose: The purpose of the class ChromeDriver is to check for the respective environment and download the required
# chrome driver for the respective environment.
# Download the latest chromedriver object
import os
import requests
from f... | [
"os.path.exists",
"flexibox.core.utility.Utility",
"flexibox.utility.os_type.OS_type",
"os.makedirs",
"requests.get",
"flexibox.core.logger.Logger"
] | [((513, 522), 'flexibox.core.utility.Utility', 'Utility', ([], {}), '()\n', (520, 522), False, 'from flexibox.core.utility import Utility\n'), ((541, 550), 'flexibox.utility.os_type.OS_type', 'OS_type', ([], {}), '()\n', (548, 550), False, 'from flexibox.utility.os_type import OS_type\n'), ((570, 578), 'flexibox.core.l... |
import tempfile
from os import name as os_name, getpid
from pathlib import Path
import json
__dir_name = '.manga-py'
def get_temp_path(*args) -> str:
"""
Returns the path of the temporary files manga-py
:param args:
:return:
"""
temp = 'temp_%s' % getpid()
return path_join(tempfile.gettem... | [
"pathlib.Path.home",
"tempfile.gettempdir",
"os.getpid",
"pathlib.Path"
] | [((2269, 2280), 'pathlib.Path', 'Path', (['_path'], {}), '(_path)\n', (2273, 2280), False, 'from pathlib import Path\n'), ((275, 283), 'os.getpid', 'getpid', ([], {}), '()\n', (281, 283), False, 'from os import name as os_name, getpid\n'), ((305, 326), 'tempfile.gettempdir', 'tempfile.gettempdir', ([], {}), '()\n', (32... |
# -*- coding: utf-8 -*-
"""
.. currentmodule:: jccli.jc_api_v1.py
.. moduleauthor:: zaro0508 <<EMAIL>>
This is a utility library for the jumpcloud version 1 api
.. note::
To learn more about the jumpcloud api 1
`project website <https://github.com/TheJumpCloud/jcapi-python/tree/master/jcapiv1>`_.
"""
from d... | [
"jccli.helpers.class_to_dict",
"jcapiv1.Systemuserput",
"jcapiv1.ApiClient",
"jcapiv1.Configuration",
"jccli.errors.SystemUserNotFoundError"
] | [((699, 722), 'jcapiv1.Configuration', 'jcapiv1.Configuration', ([], {}), '()\n', (720, 722), False, 'import jcapiv1\n'), ((6528, 6599), 'jccli.errors.SystemUserNotFoundError', 'SystemUserNotFoundError', (["('No user found for username: %s' % (username,))"], {}), "('No user found for username: %s' % (username,))\n", (6... |
# See documentation for more details
# https://apple.github.io/coremltools/generated/coremltools.converters.keras.convert.html
import coremltools
from keras.models import model_from_json
from keras.models import load_model
# load model and weights
#json_file = open('keras_model.json', 'r')
#loaded_model_json = json_fi... | [
"keras.models.load_model",
"coremltools.converters.keras.convert"
] | [((446, 480), 'keras.models.load_model', 'load_model', (['"""keras_mnist_model.h5"""'], {}), "('keras_mnist_model.h5')\n", (456, 480), False, 'from keras.models import load_model\n'), ((518, 727), 'coremltools.converters.keras.convert', 'coremltools.converters.keras.convert', (['model'], {'input_names': '"""image (28x2... |
"""mockfs: A simple mock filesystem for unit tests."""
import copy
import errno
import fnmatch
import glob
import os
import shutil
import sys
from . import compat
from . import util
# Python functions to replace
builtins = {
'glob.glob': glob.glob,
'os.chdir': os.chdir,
'os.getcwd': os.getcwd,
'os.p... | [
"os.path.isabs",
"os.path.join",
"os.path.dirname",
"sys.exc_info",
"os.path.basename",
"copy.deepcopy",
"os.strerror"
] | [((1636, 1662), 'os.path.dirname', 'os.path.dirname', (['full_path'], {}), '(full_path)\n', (1651, 1662), False, 'import os\n'), ((2951, 2972), 'os.path.dirname', 'os.path.dirname', (['path'], {}), '(path)\n', (2966, 2972), False, 'import os\n'), ((2992, 3014), 'os.path.basename', 'os.path.basename', (['path'], {}), '(... |
import os
from skimage.transform import resize
import imageio
import numpy as np
import glob
import scipy
def main():
rootdir = "/home/nbayat5/Desktop/celebA/identities"
#os.mkdir("/home/nbayat5/Desktop/celebA/face_recognition_srgan")
for subdir, dirs, files in os.walk(rootdir):
for dir ... | [
"imageio.imwrite",
"os.walk",
"os.path.join",
"numpy.asarray",
"os.chdir",
"numpy.array",
"scipy.misc.imread",
"scipy.misc.imresize",
"glob.glob"
] | [((285, 301), 'os.walk', 'os.walk', (['rootdir'], {}), '(rootdir)\n', (292, 301), False, 'import os\n'), ((1291, 1305), 'os.chdir', 'os.chdir', (['path'], {}), '(path)\n', (1299, 1305), False, 'import os\n'), ((1438, 1463), 'glob.glob', 'glob.glob', (['"""./test/*.jpg"""'], {}), "('./test/*.jpg')\n", (1447, 1463), Fals... |
#Necesario para hacer el renderizado HTML de las templates
from flask import render_template, redirect, url_for, flash, session
from app import app
from .forms import *
import csv
from .utils import *
@app.route('/')
def index():
return render_template('index.html')
@app.route('/ingresar', methods=['GE... | [
"flask.render_template",
"flask.flash",
"csv.writer",
"flask.url_for",
"app.app.errorhandler",
"app.app.route",
"flask.session.pop",
"csv.reader"
] | [((210, 224), 'app.app.route', 'app.route', (['"""/"""'], {}), "('/')\n", (219, 224), False, 'from app import app\n'), ((285, 332), 'app.app.route', 'app.route', (['"""/ingresar"""'], {'methods': "['GET', 'POST']"}), "('/ingresar', methods=['GET', 'POST'])\n", (294, 332), False, 'from app import app\n'), ((1524, 1571),... |
import sys
sys.path.append('../../../vmdgadgets')
import vmdutil
OFFSET = 5
#RANGE = [(1, 3127), (3467, 6978)]
RANGE = [(1, 3100), (3467, 6978)]
def in_range(frame, offset=0):
for r in RANGE:
if r[0] <= frame <= (r[1] + offset):
return True
else:
return False
if '__main__' == __na... | [
"vmdutil.Vmdio",
"sys.path.append"
] | [((11, 49), 'sys.path.append', 'sys.path.append', (['"""../../../vmdgadgets"""'], {}), "('../../../vmdgadgets')\n", (26, 49), False, 'import sys\n'), ((339, 354), 'vmdutil.Vmdio', 'vmdutil.Vmdio', ([], {}), '()\n', (352, 354), False, 'import vmdutil\n')] |
import conbench.runner
import pyarrow
import pyarrow.parquet as parquet
from benchmarks import _benchmark
@conbench.runner.register_benchmark
class DataframeToTableBenchmark(_benchmark.Benchmark, _benchmark.BenchmarkR):
"""
Convert a pandas dataframe to an arrow table.
DataframeToTableBenchmark().r... | [
"pyarrow.parquet.read_table",
"pyarrow.Table.from_pandas"
] | [((2567, 2603), 'pyarrow.Table.from_pandas', 'pyarrow.Table.from_pandas', (['dataframe'], {}), '(dataframe)\n', (2592, 2603), False, 'import pyarrow\n'), ((2656, 2698), 'pyarrow.parquet.read_table', 'parquet.read_table', (['path'], {'memory_map': '(False)'}), '(path, memory_map=False)\n', (2674, 2698), True, 'import py... |
# coding=utf-8
import sys
import petsc4py
petsc4py.init(sys.argv)
from pyvtk import *
import numpy as np
from scipy.io import loadmat
from src import stokes_flow as sf
from src.stokes_flow import problem_dic, obj_dic
from src.geo import *
def main_fun():
matname = 'around'
if matname[-4:] != '.mat':
... | [
"petsc4py.init"
] | [((44, 67), 'petsc4py.init', 'petsc4py.init', (['sys.argv'], {}), '(sys.argv)\n', (57, 67), False, 'import petsc4py\n')] |
from flask import Flask, render_template, request, jsonify, redirect, url_for, session, flash, Response
from flaskext.markdown import Markdown
from pymongo import MongoClient
from steem import Steem
from datetime import date, timedelta, datetime
from dateutil import parser
from slugify import slugify
import sys, traceb... | [
"flask.render_template",
"flask.request.args.get",
"flask.Flask",
"flask.request.form.to_dict",
"flask.session.pop",
"pymongo.MongoClient",
"datetime.timedelta",
"flask.jsonify",
"flaskext.markdown.Markdown",
"traceback.print_exc",
"dateutil.parser.parse",
"json.loads",
"requests.get",
"fl... | [((384, 443), 'flask.Flask', 'Flask', (['__name__'], {'static_folder': '"""static"""', 'static_url_path': '""""""'}), "(__name__, static_folder='static', static_url_path='')\n", (389, 443), False, 'from flask import Flask, render_template, request, jsonify, redirect, url_for, session, flash, Response\n'), ((574, 587), ... |
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incor... | [
"os.path.abspath",
"azure.cli.testsdk.StorageAccountPreparer",
"azure.cli.testsdk.ResourceGroupPreparer"
] | [((2507, 2612), 'azure.cli.testsdk.ResourceGroupPreparer', 'ResourceGroupPreparer', ([], {'name_prefix': '"""clitesthealthcareapis_rgname"""[:7]', 'key': '"""rg"""', 'parameter_name': '"""rg"""'}), "(name_prefix='clitesthealthcareapis_rgname'[:7], key=\n 'rg', parameter_name='rg')\n", (2528, 2612), False, 'from azur... |
import multiprocessing
def sum_up_to(number):
return sum(range(1, number + 1))
if __name__ == '__main__':
# Create pool object
pool = multiprocessing.Pool(4)
# Run `sum_up_to` 10 times simultaneously
result = pool.map(sum_up_to, range(10))
print(result) | [
"multiprocessing.Pool"
] | [((152, 175), 'multiprocessing.Pool', 'multiprocessing.Pool', (['(4)'], {}), '(4)\n', (172, 175), False, 'import multiprocessing\n')] |
import torch
import torch.nn as nn
from torch.nn import Parameter as P
from torchvision.models.inception import inception_v3
import torch.nn.functional as F
# Module that wraps the inception network to enable use with dataparallel and
# returning pool features and logits.
class WrapInception(nn.Module):
def __init... | [
"torchvision.models.inception.inception_v3",
"torch.nn.DataParallel",
"torch.nn.functional.dropout",
"torch.tensor",
"torch.nn.functional.interpolate",
"torch.nn.functional.max_pool2d"
] | [((2340, 2392), 'torchvision.models.inception.inception_v3', 'inception_v3', ([], {'pretrained': '(True)', 'transform_input': '(False)'}), '(pretrained=True, transform_input=False)\n', (2352, 2392), False, 'from torchvision.models.inception import inception_v3\n'), ((1101, 1141), 'torch.nn.functional.max_pool2d', 'F.ma... |
from django.db import models
from django.utils.translation import gettext_lazy as _
from paper_uploads.models import *
from paper_uploads.cloudinary.models import *
__all__ = [
"CustomUploadedFile",
"CustomUploadedImage",
"CustomCloudinaryFile",
"CustomProxyGallery",
"CustomGallery",
"CustomCl... | [
"django.utils.translation.gettext_lazy"
] | [((1133, 1145), 'django.utils.translation.gettext_lazy', '_', (['"""caption"""'], {}), "('caption')\n", (1134, 1145), True, 'from django.utils.translation import gettext_lazy as _\n'), ((1335, 1347), 'django.utils.translation.gettext_lazy', '_', (['"""caption"""'], {}), "('caption')\n", (1336, 1347), True, 'from django... |
# -*- coding: utf-8 -*-
"""setup.py: setuptools control."""
from setuptools import setup
setup(name='xyz2rast',
version='0.1.1',
description='Gridding algorithm for time series XYZ data',
url='https://github.com/tashley/xyz2rast.git',
author='<NAME>',
author_email='<EMAIL>',
lic... | [
"setuptools.setup"
] | [((94, 353), 'setuptools.setup', 'setup', ([], {'name': '"""xyz2rast"""', 'version': '"""0.1.1"""', 'description': '"""Gridding algorithm for time series XYZ data"""', 'url': '"""https://github.com/tashley/xyz2rast.git"""', 'author': '"""<NAME>"""', 'author_email': '"""<EMAIL>"""', 'license': '"""MIT"""', 'packages': "... |
# The MIT License
#
# Copyright (c) 2008 <NAME>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge,... | [
"ns.bridge.data.Scene.Scene",
"maya.OpenMaya.MSyntax",
"ns.bridge.io.MasReader.read",
"maya.cmds.undoInfo",
"maya.OpenMayaMPx.MPxCommand.__init__",
"maya.OpenMaya.MArgList",
"ns.maya.msv.MayaAgent.Options",
"ns.maya.msv.MayaSim.MayaSim",
"ns.bridge.data.Sim.Sim",
"gc.collect"
] | [((9528, 9546), 'maya.OpenMaya.MSyntax', 'OpenMaya.MSyntax', ([], {}), '()\n', (9544, 9546), True, 'import maya.OpenMaya as OpenMaya\n'), ((2676, 2713), 'maya.OpenMayaMPx.MPxCommand.__init__', 'OpenMayaMPx.MPxCommand.__init__', (['self'], {}), '(self)\n', (2707, 2713), True, 'import maya.OpenMayaMPx as OpenMayaMPx\n'),... |
import tensorflow as tf
def maxPoolLayer(x, ksize, stride, padding='VALID', name=None):
return tf.nn.max_pool(x,
ksize=[1, ksize, ksize, 1],
strides=[1, stride, stride, 1],
padding=padding,
name=name)
def LRN... | [
"tensorflow.nn.local_response_normalization",
"tensorflow.nn.conv2d",
"tensorflow.nn.max_pool",
"tensorflow.variable_scope",
"tensorflow.nn.relu",
"tensorflow.pad",
"tensorflow.contrib.layers.l2_regularizer",
"tensorflow.split",
"tensorflow.nn.xw_plus_b",
"tensorflow.random_normal_initializer",
... | [((101, 211), 'tensorflow.nn.max_pool', 'tf.nn.max_pool', (['x'], {'ksize': '[1, ksize, ksize, 1]', 'strides': '[1, stride, stride, 1]', 'padding': 'padding', 'name': 'name'}), '(x, ksize=[1, ksize, ksize, 1], strides=[1, stride, stride, 1\n ], padding=padding, name=name)\n', (115, 211), True, 'import tensorflow as ... |
from setuptools import setup, find_packages
setup(name='Multilevel MDA-Lite Paris Traceroute',
version='0.1',
description='Costless version of MDA + Router level view of traceroute',
url='https://gitlab.planet-lab.eu/',
author='<NAME>,',
author_email='<EMAIL>',
license='MIT',
... | [
"setuptools.find_packages"
] | [((329, 344), 'setuptools.find_packages', 'find_packages', ([], {}), '()\n', (342, 344), False, 'from setuptools import setup, find_packages\n')] |
#!/usr/bin/env pybricks-micropython
# ↑ Interpretador do python definido para o EV3
# Importações dos módulos utilizados
# Módulo principal do brick importado da biblioteca principal
from pybricks import ev3brick as brick
# Módulo dos botões do brick
from pybricks.parameters import Button
# Módulo de esperar, dentro d... | [
"Botoes_1.pressionado",
"pybricks.ev3brick.buttons",
"pybricks.tools.wait"
] | [((976, 991), 'pybricks.ev3brick.buttons', 'brick.buttons', ([], {}), '()\n', (989, 991), True, 'from pybricks import ev3brick as brick\n'), ((1275, 1293), 'Botoes_1.pressionado', 'pressionado', (['botao'], {}), '(botao)\n', (1286, 1293), False, 'from Botoes_1 import pressionado\n'), ((1336, 1344), 'pybricks.tools.wait... |
# -*- coding: utf-8 -*-
import os
import unittest
from intercom.client import Client
intercom = Client(
os.environ.get('INTERCOM_PERSONAL_ACCESS_TOKEN'))
class SegmentTest(unittest.TestCase):
@classmethod
def setup_class(cls):
cls.segment = intercom.segments.all()[0]
def test_find_segment(... | [
"os.environ.get"
] | [((110, 158), 'os.environ.get', 'os.environ.get', (['"""INTERCOM_PERSONAL_ACCESS_TOKEN"""'], {}), "('INTERCOM_PERSONAL_ACCESS_TOKEN')\n", (124, 158), False, 'import os\n')] |
import os
import json
import logging
from functools import partial
from json import JSONDecodeError
from typing import Any, Dict, List, NamedTuple, Union
import requests
from tcgplayer_api.auth import BearerAuth
from tcgplayer_api.utils import words_to_snake_case
logger = logging.getLogger(__name__)
# TODO: Consi... | [
"logging.getLogger",
"os.listdir",
"requests.Session",
"os.path.dirname",
"tcgplayer_api.utils.words_to_snake_case",
"json.load"
] | [((277, 304), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (294, 304), False, 'import logging\n'), ((991, 1009), 'requests.Session', 'requests.Session', ([], {}), '()\n', (1007, 1009), False, 'import requests\n'), ((1796, 1821), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), ... |
#!/usr/bin/python3
# -*- coding: utf-8 -*-
from setuptools import setup, find_packages
from os import path
this_directory = path.abspath(path.dirname(__file__))
with open(path.join(this_directory, 'README.md'), encoding='utf-8') as f:
long_description = f.read()
setup(
name='xacro4sdf',
version='2.1.0',... | [
"os.path.dirname",
"setuptools.find_packages",
"os.path.join"
] | [((138, 160), 'os.path.dirname', 'path.dirname', (['__file__'], {}), '(__file__)\n', (150, 160), False, 'from os import path\n'), ((172, 210), 'os.path.join', 'path.join', (['this_directory', '"""README.md"""'], {}), "(this_directory, 'README.md')\n", (181, 210), False, 'from os import path\n'), ((735, 750), 'setuptool... |
import time, base64, hmac, hashlib, json, requests
class BtcTurk():
BASE_URL = "https://api.btcturk.com"
GRAPH_BASE_URL = "https://graph-api.btcturk.com"
def __init__(self, api_key=None, api_Secret=None):
self.api_key = api_key
self.api_Secret = api_Secret
def _headers(self,protection... | [
"hmac.new",
"base64.b64encode",
"json.dumps",
"base64.b64decode",
"requests.get",
"time.time"
] | [((3775, 3803), 'json.dumps', 'json.dumps', (['result'], {'indent': '(2)'}), '(result, indent=2)\n', (3785, 3803), False, 'import time, base64, hmac, hashlib, json, requests\n'), ((4040, 4068), 'json.dumps', 'json.dumps', (['result'], {'indent': '(2)'}), '(result, indent=2)\n', (4050, 4068), False, 'import time, base64... |
import os
from pathlib import Path
from moonleap.utils.case import sn
from titan.project_pkg.dockercompose import DockerComposeConfig
def _make_abs(service, p):
result = Path(p)
if not Path(os.path.expandvars(p)).is_absolute():
base_path = Path("/opt") / sn(service.project.name) / service.name
... | [
"os.path.expandvars",
"moonleap.utils.case.sn",
"pathlib.Path"
] | [((177, 184), 'pathlib.Path', 'Path', (['p'], {}), '(p)\n', (181, 184), False, 'from pathlib import Path\n'), ((259, 271), 'pathlib.Path', 'Path', (['"""/opt"""'], {}), "('/opt')\n", (263, 271), False, 'from pathlib import Path\n'), ((274, 298), 'moonleap.utils.case.sn', 'sn', (['service.project.name'], {}), '(service.... |
# -*- coding: utf-8 -*-
"""
Created on Tue Nov 24 23:15:17 2020
@author: <NAME>
"""
import requests
def mals(file_dest):
url = 'https://www.virustotal.com/vtapi/v2/file/scan'
params = {'apikey': '<KEY>'}
files = {'file': (file_dest, open(file_dest, 'rb'))}
response = ... | [
"requests.post",
"requests.get"
] | [((320, 366), 'requests.post', 'requests.post', (['url'], {'files': 'files', 'params': 'params'}), '(url, files=files, params=params)\n', (333, 366), False, 'import requests\n'), ((597, 629), 'requests.get', 'requests.get', (['url'], {'params': 'params'}), '(url, params=params)\n', (609, 629), False, 'import requests\n... |
# -*- coding: utf-8 -*-
"""
Created on Fri Sep 14 10:05:08 2018
Modified on Tue Nov 12 21:19:10 2019
@author1: <NAME>
@author2: <NAME>
"""
import keras.layers as L
import keras
import matplotlib.pyplot as plt
# get_model()
def get_model():
print("build_model.py..get_model().start...")
'''
return:
... | [
"keras.layers.Conv2D",
"matplotlib.pyplot.savefig",
"keras.layers.Flatten",
"keras.layers.MaxPooling2D",
"keras.Model",
"matplotlib.pyplot.plot",
"keras.models.Sequential",
"keras.layers.Input",
"matplotlib.pyplot.figure",
"keras.layers.Dense",
"matplotlib.pyplot.title",
"keras.layers.MaxPool2... | [((526, 552), 'keras.layers.Input', 'L.Input', ([], {'shape': '(48, 48, 1)'}), '(shape=(48, 48, 1))\n', (533, 552), True, 'import keras.layers as L\n'), ((996, 1035), 'keras.Model', 'keras.Model', ([], {'input': 'input', 'output': 'output'}), '(input=input, output=output)\n', (1007, 1035), False, 'import keras\n'), ((1... |
import pandas as pd
import time
from contextlib import contextmanager
from tqdm import tqdm
tqdm.pandas()
# nice way to report running times
@contextmanager
def timer(name):
t0 = time.time()
yield
print(f'[{name}] done in {time.time() - t0:.0f} s')
def get_named_entities(df):
"""
Count the name... | [
"pandas.DataFrame",
"tqdm.tqdm.pandas",
"time.time"
] | [((93, 106), 'tqdm.tqdm.pandas', 'tqdm.pandas', ([], {}), '()\n', (104, 106), False, 'from tqdm import tqdm\n'), ((186, 197), 'time.time', 'time.time', ([], {}), '()\n', (195, 197), False, 'import time\n'), ((537, 591), 'pandas.DataFrame', 'pd.DataFrame', (['(0)'], {'index': 'df.index', 'columns': "['named_ent']"}), "(... |
from monty.dev import deprecated
import pytest
from pymatgen.core import Structure, Composition
from pymatgen.util.testing import PymatgenTest
from emmet.core.chemenv import ChemEnvDoc
test_structures = {
name: struc.get_reduced_structure()
for name, struc in PymatgenTest.TEST_STRUCTURES.items()
if name
... | [
"pymatgen.util.testing.PymatgenTest.TEST_STRUCTURES.items",
"emmet.core.chemenv.ChemEnvDoc.from_structure",
"pymatgen.core.Composition"
] | [((813, 898), 'emmet.core.chemenv.ChemEnvDoc.from_structure', 'ChemEnvDoc.from_structure', ([], {'structure': 'structure', 'material_id': '(33)', 'deprecated': '(False)'}), '(structure=structure, material_id=33, deprecated=False\n )\n', (838, 898), False, 'from emmet.core.chemenv import ChemEnvDoc\n'), ((270, 306), ... |
"""Defines the serializers for Scale files and workspaces"""
from __future__ import unicode_literals
import rest_framework.serializers as serializers
from rest_framework.fields import CharField
from util.rest import ModelIdSerializer
class DataTypeField(CharField):
"""Field for displaying the list of data type t... | [
"rest_framework.serializers.DateTimeField",
"batch.serializers.BatchBaseSerializerV6",
"rest_framework.serializers.IntegerField",
"rest_framework.serializers.BooleanField",
"rest_framework.serializers.URLField",
"rest_framework.serializers.JSONField",
"rest_framework.serializers.StringRelatedField",
"... | [((1848, 1871), 'rest_framework.serializers.CharField', 'serializers.CharField', ([], {}), '()\n', (1869, 1871), True, 'import rest_framework.serializers as serializers\n'), ((1995, 2018), 'rest_framework.serializers.CharField', 'serializers.CharField', ([], {}), '()\n', (2016, 2018), True, 'import rest_framework.seria... |
#!/usr/bin/env python
# coding: utf-8
# # Gender Recognition by Voice Kaggle [ Test Accuracy : 99.08 % ]
# In[ ]:
# ## CONTENTS::
# [ **1 ) Importing Various Modules and Loading the Dataset**](#content1)
# [ **2 ) Exploratory Data Analysis (EDA)**](#content2)
# [ **3 ) OutlierTreatment**](#content3)
# [ **4... | [
"pandas.read_csv",
"sklearn.neighbors.KNeighborsClassifier",
"missingno.matrix",
"numpy.array",
"matplotlib.style.use",
"seaborn.set",
"seaborn.distplot",
"sklearn.tree.DecisionTreeClassifier",
"pandas.DataFrame",
"numpy.tril_indices_from",
"sklearn.model_selection.train_test_split",
"matplotl... | [((600, 633), 'warnings.filterwarnings', 'warnings.filterwarnings', (['"""always"""'], {}), "('always')\n", (623, 633), False, 'import warnings\n'), ((634, 667), 'warnings.filterwarnings', 'warnings.filterwarnings', (['"""ignore"""'], {}), "('ignore')\n", (657, 667), False, 'import warnings\n'), ((945, 973), 'matplotli... |