code stringlengths 22 1.05M | apis listlengths 1 3.31k | extract_api stringlengths 75 3.25M |
|---|---|---|
# richard -- video index system
# Copyright (C) 2012, 2013, 2014, 2015 richard contributors. See AUTHORS.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the Licens... | [
"django.conf.urls.url"
] | [((886, 953), 'django.conf.urls.url', 'url', (['"""^playlist/$"""', '"""playlist_list"""'], {'name': '"""playlists-playlist-list"""'}), "('^playlist/$', 'playlist_list', name='playlists-playlist-list')\n", (889, 953), False, 'from django.conf.urls import patterns, url\n'), ((968, 1046), 'django.conf.urls.url', 'url', (... |
import os
import sys
# train test1 test2 test3
def readtst(tstfn):
outlist = list()
with open(tstfn) as br:
for aline in br.readlines():
aline = aline.strip()
outlist.append(aline)
return outlist
def split_train_tests_xml(xmlpath, test1fn, test2fn, test3fn):
test1list ... | [
"os.path.abspath",
"os.path.join",
"os.listdir"
] | [((589, 608), 'os.listdir', 'os.listdir', (['xmlpath'], {}), '(xmlpath)\n', (599, 608), False, 'import os\n'), ((1124, 1143), 'os.listdir', 'os.listdir', (['wavpath'], {}), '(wavpath)\n', (1134, 1143), False, 'import os\n'), ((1467, 1496), 'os.path.join', 'os.path.join', (['outpath', '"""text"""'], {}), "(outpath, 'tex... |
# Generated with GeneratorTorqueFault
#
from enum import Enum
from enum import auto
class GeneratorTorqueFault(Enum):
""""""
NONE = auto()
LOSS = auto()
BACKUP = auto()
def label(self):
if self == GeneratorTorqueFault.NONE:
return "No generator torque fault"
if self ==... | [
"enum.auto"
] | [((142, 148), 'enum.auto', 'auto', ([], {}), '()\n', (146, 148), False, 'from enum import auto\n'), ((160, 166), 'enum.auto', 'auto', ([], {}), '()\n', (164, 166), False, 'from enum import auto\n'), ((180, 186), 'enum.auto', 'auto', ([], {}), '()\n', (184, 186), False, 'from enum import auto\n')] |
import os
def test_net(dir_net='exp/dnn4_pretrain-dbn_dnn/final.nnet'):
flag = os.system('./local/nnet/test_wer.sh %s >/dev/null 2>&1 '%dir_net)#
assert flag == 0
os.system('bash show_dnn test > res.log')
content = open('res.log').read()
res = float(content.split()[1])
return res
def finetun... | [
"os.system"
] | [((85, 152), 'os.system', 'os.system', (["('./local/nnet/test_wer.sh %s >/dev/null 2>&1 ' % dir_net)"], {}), "('./local/nnet/test_wer.sh %s >/dev/null 2>&1 ' % dir_net)\n", (94, 152), False, 'import os\n'), ((177, 218), 'os.system', 'os.system', (['"""bash show_dnn test > res.log"""'], {}), "('bash show_dnn test > res.... |
from heuslertools.xrd import O2TSimulation
from heuslertools.xrd.materials import NiMnSb, InP
import xrayutilities as xu
import numpy as np
import matplotlib.pyplot as plt
##### LAYERSTACK #####
sub = xu.simpack.Layer(InP, np.inf)
lay1 = xu.simpack.Layer(NiMnSb, 400, relaxation=0.0)
layerstack = xu.simpack.Pseudomorph... | [
"matplotlib.pyplot.show",
"xrayutilities.simpack.Layer",
"heuslertools.xrd.O2TSimulation",
"xrayutilities.simpack.PseudomorphicStack001",
"matplotlib.pyplot.figure",
"matplotlib.pyplot.semilogy"
] | [((202, 231), 'xrayutilities.simpack.Layer', 'xu.simpack.Layer', (['InP', 'np.inf'], {}), '(InP, np.inf)\n', (218, 231), True, 'import xrayutilities as xu\n'), ((239, 284), 'xrayutilities.simpack.Layer', 'xu.simpack.Layer', (['NiMnSb', '(400)'], {'relaxation': '(0.0)'}), '(NiMnSb, 400, relaxation=0.0)\n', (255, 284), T... |
from dungeonfeature import new_stairs_up
import dungeonfeature
import terrain
import tile
from dungeonlevel import DungeonLevel
def get_empty_tile_matrix(width, height):
return [[tile.Tile()
for x in range(width)]
for y in range(height)]
def unknown_level_map(width, height, depth):
... | [
"terrain.Water",
"dungeonfeature.new_stairs_up",
"dungeonfeature.new_plant",
"terrain.GlassWall",
"terrain.Chasm",
"terrain.Floor",
"dungeonlevel.DungeonLevel",
"terrain.Door",
"tile.Tile",
"terrain.Wall"
] | [((391, 423), 'dungeonlevel.DungeonLevel', 'DungeonLevel', (['tile_matrix', 'depth'], {}), '(tile_matrix, depth)\n', (403, 423), False, 'from dungeonlevel import DungeonLevel\n'), ((671, 702), 'dungeonlevel.DungeonLevel', 'DungeonLevel', (['terrain_matrix', '(1)'], {}), '(terrain_matrix, 1)\n', (683, 702), False, 'from... |
import numpy as np
import pandas as pd
from .nlp_utils.classifier import NaiveBayesClassifier
from .nlp_utils.tokenizer import NGramTokenizer
DATASET_PATH = 'spam_filter/data/spam.csv'
def preprocess_data():
dataset = pd.read_csv(DATASET_PATH, encoding='latin-1')
dataset.rename(columns={'v1': 'labels', 'v2'... | [
"pandas.read_csv",
"numpy.random.uniform"
] | [((226, 271), 'pandas.read_csv', 'pd.read_csv', (['DATASET_PATH'], {'encoding': '"""latin-1"""'}), "(DATASET_PATH, encoding='latin-1')\n", (237, 271), True, 'import pandas as pd\n'), ((558, 581), 'numpy.random.uniform', 'np.random.uniform', (['(0)', '(1)'], {}), '(0, 1)\n', (575, 581), True, 'import numpy as np\n')] |
#!/usr/bin/python3
# -*- coding: utf-8 -*-
import pypandoc
import os
print("Pandoc", pypandoc.get_pandoc_version())
base = "../../Note/"
for r, ds, fs in os.walk(base):
for f in fs:
if f.endswith(".md"):
src = r+"/"+f
dst = src.replace(".md", ".pdf")
print(src, "->", ... | [
"os.walk",
"pypandoc.convert_file",
"pypandoc.get_pandoc_version"
] | [((158, 171), 'os.walk', 'os.walk', (['base'], {}), '(base)\n', (165, 171), False, 'import os\n'), ((87, 116), 'pypandoc.get_pandoc_version', 'pypandoc.get_pandoc_version', ([], {}), '()\n', (114, 116), False, 'import pypandoc\n'), ((343, 507), 'pypandoc.convert_file', 'pypandoc.convert_file', (['src', '"""pdf"""'], {'... |
from mysql.connector.errors import OperationalError
import pytest
from test.helpers import db_fixture, execute
@pytest.fixture(scope="session")
def warehouse():
return db_fixture("test_warehouse")
@pytest.fixture
def empty_warehouse(warehouse):
cursor = warehouse.cursor()
cursor.execute("SHOW TABLES")
... | [
"test.helpers.db_fixture",
"pytest.fixture",
"test.helpers.execute"
] | [((115, 146), 'pytest.fixture', 'pytest.fixture', ([], {'scope': '"""session"""'}), "(scope='session')\n", (129, 146), False, 'import pytest\n'), ((175, 203), 'test.helpers.db_fixture', 'db_fixture', (['"""test_warehouse"""'], {}), "('test_warehouse')\n", (185, 203), False, 'from test.helpers import db_fixture, execute... |
from .import views
from django.urls import path
from django.conf import settings
from django.conf.urls.static import static
from . views import *
# Application Views
urlpatterns = [
path('', views.user_login, name='login'),
path('logout/', views.user_logout, name='logout'),
path('signup/', views.user_sign... | [
"django.conf.urls.static.static",
"django.urls.path"
] | [((188, 228), 'django.urls.path', 'path', (['""""""', 'views.user_login'], {'name': '"""login"""'}), "('', views.user_login, name='login')\n", (192, 228), False, 'from django.urls import path\n'), ((234, 283), 'django.urls.path', 'path', (['"""logout/"""', 'views.user_logout'], {'name': '"""logout"""'}), "('logout/', v... |
import cv2
import json
from daisykit.utils import get_asset_file
from daisykit import BarcodeScannerFlow
config = {
"try_harder": True,
"try_rotate": True
}
barcode_scanner_flow = BarcodeScannerFlow(json.dumps(config))
# Open video stream from webcam
vid = cv2.VideoCapture(0)
while(True):
# Capture the... | [
"cv2.cvtColor",
"cv2.waitKey",
"cv2.imshow",
"json.dumps",
"cv2.VideoCapture",
"cv2.destroyAllWindows"
] | [((268, 287), 'cv2.VideoCapture', 'cv2.VideoCapture', (['(0)'], {}), '(0)\n', (284, 287), False, 'import cv2\n'), ((839, 862), 'cv2.destroyAllWindows', 'cv2.destroyAllWindows', ([], {}), '()\n', (860, 862), False, 'import cv2\n'), ((209, 227), 'json.dumps', 'json.dumps', (['config'], {}), '(config)\n', (219, 227), Fals... |
from django import forms
from django.contrib.auth import get_user_model
from django.template.defaultfilters import filesizeformat
from django.utils.translation import ugettext_lazy as _
from django.contrib.auth.models import Group
from os import path
from .models import User
from texaslan.applications.models import A... | [
"django.forms.TextInput",
"texaslan.applications.models.Application.objects.get_or_create",
"django.contrib.auth.models.Group.objects.get"
] | [((1094, 1131), 'django.contrib.auth.models.Group.objects.get', 'Group.objects.get', ([], {'name': '"""Open Rushie"""'}), "(name='Open Rushie')\n", (1111, 1131), False, 'from django.contrib.auth.models import Group\n'), ((1240, 1301), 'texaslan.applications.models.Application.objects.get_or_create', 'Application.object... |
import click
from PyInquirer import prompt
from one.utils.environment.common import get_credentials_file, get_config_file, get_idp_file, write_config
from one.utils.prompt import style
from one.docker.image import Image
from one.docker.container import Container
from one.__init__ import CLI_ROOT
from one.prompt.idp imp... | [
"one.utils.environment.common.get_idp_file",
"one.utils.environment.common.get_config_file",
"one.docker.container.Container",
"click.echo",
"one.docker.image.Image",
"one.utils.environment.common.get_credentials_file",
"one.utils.environment.common.write_config",
"PyInquirer.prompt"
] | [((456, 463), 'one.docker.image.Image', 'Image', ([], {}), '()\n', (461, 463), False, 'from one.docker.image import Image\n'), ((476, 487), 'one.docker.container.Container', 'Container', ([], {}), '()\n', (485, 487), False, 'from one.docker.container import Container\n'), ((533, 572), 'PyInquirer.prompt', 'prompt', (['... |
import matplotlib.pyplot as plt
import pandas as pd
from utils import *
# 主索节点的坐标和编号
data1 = pd.read_csv("data/附件1.csv", encoding='ANSI')
# print('主索节点的坐标和编号:\n', data1)
nodes_data = {}
for d in data1.itertuples():
nodes_data[d[1]] = {
# 'position': tuple(d[2:]),
'position_raw': np.array(d[2:]),
... | [
"matplotlib.pyplot.xlim",
"matplotlib.pyplot.show",
"matplotlib.pyplot.ylim",
"pandas.read_csv",
"matplotlib.pyplot.axes"
] | [((94, 138), 'pandas.read_csv', 'pd.read_csv', (['"""data/附件1.csv"""'], {'encoding': '"""ANSI"""'}), "('data/附件1.csv', encoding='ANSI')\n", (105, 138), True, 'import pandas as pd\n'), ((467, 511), 'pandas.read_csv', 'pd.read_csv', (['"""data/附件2.csv"""'], {'encoding': '"""ANSI"""'}), "('data/附件2.csv', encoding='ANSI')\... |
#!/usr/bin/env python
# vim:fileencoding=UTF-8:ts=4:sw=4:sta:et:sts=4:ai
__license__ = 'GPL v3'
__copyright__ = '2011, Kov<NAME> <<EMAIL>>; 2011, <NAME> <<EMAIL>>'
__docformat__ = 'restructuredtext en'
import time
try:
from queue import Empty, Queue
except ImportError:
from Queue import Empty, Queue
from cal... | [
"json.loads",
"calibre.utils.date.utcnow",
"Queue.Queue",
"calibre.ebooks.metadata.sources.test.title_test",
"calibre.ebooks.metadata.book.base.Metadata",
"time.sleep",
"calibre.ebooks.metadata.sources.test.authors_test",
"calibre.ebooks.metadata.check_isbn",
"calibre.utils.date.parse_date",
"cali... | [((2496, 2539), 'calibre.ebooks.metadata.sources.base.Source.save_settings', 'Source.save_settings', (['self', '*args'], {}), '(self, *args, **kwargs)\n', (2516, 2539), False, 'from calibre.ebooks.metadata.sources.base import Option, Source\n'), ((3501, 3525), 'calibre.ebooks.metadata.book.base.Metadata', 'Metadata', (... |
# Copyright (c) 2013 Rackspace, 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 to in wr... | [
"oslo_utils.timeutils.utcnow"
] | [((925, 943), 'oslo_utils.timeutils.utcnow', 'timeutils.utcnow', ([], {}), '()\n', (941, 943), False, 'from oslo_utils import timeutils\n')] |
import numpy as np
import cv2
# Translation is the shifting of objects location. If you know the shift in
# (x,y) direction, let it be (t_x,t_y), you can create the transformation matrix
# M as follows:
#
# M = | 1 0 t_x |
# | 0 1 t_y |
#
# You'll need to make it into a Numpy array of type np.floa... | [
"cv2.waitKey",
"cv2.destroyAllWindows",
"numpy.float32",
"cv2.imread",
"cv2.warpAffine",
"cv2.imshow"
] | [((377, 411), 'cv2.imread', 'cv2.imread', (['"""images/saturn.png"""', '(0)'], {}), "('images/saturn.png', 0)\n", (387, 411), False, 'import cv2\n'), ((475, 529), 'numpy.float32', 'np.float32', (['[[1, 0, translate_x], [0, 1, translate_y]]'], {}), '([[1, 0, translate_x], [0, 1, translate_y]])\n', (485, 529), True, 'imp... |
import boto3
from rebelykos.core.response import Response as res
from rebelykos.core.teamserver.module import Module
class RLModule(Module):
def __init__(self):
super().__init__()
self.name = "role_info"
self.description = ("List all RoleNames if RoleName not specified."
... | [
"boto3.resource",
"boto3.client"
] | [((728, 766), 'boto3.client', 'boto3.client', (['"""iam"""'], {}), "('iam', **self['profile'])\n", (740, 766), False, 'import boto3\n'), ((815, 836), 'boto3.resource', 'boto3.resource', (['"""iam"""'], {}), "('iam')\n", (829, 836), False, 'import boto3\n')] |
"""
Quality-biased ranking (Bendersky et al., 2011)
"""
import argparse
import bs4
import collections
import json
import math
# import re
import string
from smart_open import smart_open
# Module side
#
class Pipeline():
"""Feature extraction pipeline"""
def __init__(self):
self.jobs = []
def add... | [
"argparse.ArgumentParser",
"smart_open.smart_open",
"bs4.BeautifulSoup",
"collections.Counter",
"math.log"
] | [((2271, 2297), 'collections.Counter', 'collections.Counter', (['terms'], {}), '(terms)\n', (2290, 2297), False, 'import collections\n'), ((3689, 3721), 'bs4.BeautifulSoup', 'bs4.BeautifulSoup', (['chunk', '"""lxml"""'], {}), "(chunk, 'lxml')\n", (3706, 3721), False, 'import bs4\n'), ((4000, 4044), 'argparse.ArgumentPa... |
import os
import c4d
import math
# Be sure to use a unique ID obtained from www.plugincafe.com
PLUGIN_ID = 123456790
#----begin_resource_section----
from bootstrap4c4d import Description, Assignment, Group, Container
crumb_percent_slider = [
Assignment("STEP", 1.0),
Assignment("UNIT", "PERCENT"),
Assignm... | [
"bootstrap4c4d.Assignment",
"bootstrap4c4d.Description",
"c4d.EventAdd",
"c4d.GetViewColor",
"bootstrap4c4d.Group",
"c4d.Vector",
"c4d.bitmaps.BaseBitmap",
"c4d.plugins.RegisterTagPlugin",
"c4d.Matrix",
"os.path.split",
"os.path.join",
"c4d.utils.MixVec"
] | [((580, 604), 'bootstrap4c4d.Assignment', 'Assignment', (['"""DEFAULT"""', '(1)'], {}), "('DEFAULT', 1)\n", (590, 604), False, 'from bootstrap4c4d import Description, Assignment, Group, Container\n'), ((633, 844), 'bootstrap4c4d.Description', 'Description', (["{'id': 'SETTINGS_EFFECT_STRENGTH', 'key': 'REAL', 'value': ... |
from itertools import count
from utils import pentagonal
def pentagonal_number(index: int) -> int:
return index * (3 * index - 1) // 2
# TODO: improve this "bruteforcefully" working function
def pentagonal_numbers(offset: int) -> int:
for j in count(1):
p_j = pentagonal_number(j)
for s in r... | [
"itertools.count",
"utils.pentagonal"
] | [((257, 265), 'itertools.count', 'count', (['(1)'], {}), '(1)\n', (262, 265), False, 'from itertools import count\n'), ((456, 471), 'utils.pentagonal', 'pentagonal', (['p_k'], {}), '(p_k)\n', (466, 471), False, 'from utils import pentagonal\n'), ((476, 491), 'utils.pentagonal', 'pentagonal', (['p_d'], {}), '(p_d)\n', (... |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.2 on 2016-11-14 02:28
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('api', '0008_merge_20161114_0228'),
]
operations = [
migrations.AlterField(
... | [
"django.db.models.CharField"
] | [((400, 431), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(50)'}), '(max_length=50)\n', (416, 431), False, 'from django.db import migrations, models\n'), ((556, 587), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(30)'}), '(max_length=30)\n', (572, 587), False, 'from ... |
from chainer_transformer.functions import generate_positional_encodings
import pytest
def test_generate_positional_encoding():
start = 0
end = 100
dim = 256
l = end - start
output = generate_positional_encodings(start, end, dim)
assert output.shape == (l, dim)
| [
"chainer_transformer.functions.generate_positional_encodings"
] | [((206, 252), 'chainer_transformer.functions.generate_positional_encodings', 'generate_positional_encodings', (['start', 'end', 'dim'], {}), '(start, end, dim)\n', (235, 252), False, 'from chainer_transformer.functions import generate_positional_encodings\n')] |
from abc import ABCMeta, abstractmethod
try:
from flan import istruthy, error, info
except:
from flan.flan import istruthy, error, info
pass
import settings
import os
import threading
import _thread as thread
def _timeout(exportname):
error('Flan->%s import timed out' % exportname)
thread.interrup... | [
"flan.flan.istruthy",
"threading.Timer",
"flan.flan.info",
"os._exit",
"flan.flan.error",
"_thread.interrupt_main"
] | [((253, 300), 'flan.flan.error', 'error', (["('Flan->%s import timed out' % exportname)"], {}), "('Flan->%s import timed out' % exportname)\n", (258, 300), False, 'from flan.flan import istruthy, error, info\n'), ((305, 328), '_thread.interrupt_main', 'thread.interrupt_main', ([], {}), '()\n', (326, 328), True, 'import... |
from torch import nn
import torch.nn.functional as F
class LeNet(nn.Module):
"""LeNet-like network for tests with MNIST (28x28)."""
def __init__(self, in_channels=1, num_classes=10, **kwargs):
super().__init__()
# main part of the network
self.conv1 = nn.Conv2d(in_channels, 6, 5)
... | [
"torch.nn.Conv2d",
"torch.nn.functional.max_pool2d",
"torch.nn.Linear"
] | [((287, 315), 'torch.nn.Conv2d', 'nn.Conv2d', (['in_channels', '(6)', '(5)'], {}), '(in_channels, 6, 5)\n', (296, 315), False, 'from torch import nn\n'), ((337, 356), 'torch.nn.Conv2d', 'nn.Conv2d', (['(6)', '(16)', '(5)'], {}), '(6, 16, 5)\n', (346, 356), False, 'from torch import nn\n'), ((376, 399), 'torch.nn.Linear... |
from django.conf import settings
from django.shortcuts import get_object_or_404
from .models import Product
def favourites():
"""This view iterates through the favourites"""
favourite_items = []
shop_items = Product.objects.all()
for item in shop_items:
shop_item = get_object_or_404(Product, p... | [
"django.shortcuts.get_object_or_404"
] | [((292, 330), 'django.shortcuts.get_object_or_404', 'get_object_or_404', (['Product'], {'pk': 'item_id'}), '(Product, pk=item_id)\n', (309, 330), False, 'from django.shortcuts import get_object_or_404\n')] |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# @Date : 2019-05-31 00:14:27
# @Author : Racter (<EMAIL>)
# @Profile : https://racterub.me
import yaml
from argparse import ArgumentParser
import os
import sys
import shutil
from subprocess import check_output
def parseParam():
parser = ArgumentParser()
... | [
"os.mkdir",
"os.path.abspath",
"os.chmod",
"argparse.ArgumentParser",
"os.path.isdir",
"subprocess.check_output",
"yaml.dump",
"os.system",
"shutil.move",
"os.listdir",
"sys.exit"
] | [((299, 315), 'argparse.ArgumentParser', 'ArgumentParser', ([], {}), '()\n', (313, 315), False, 'from argparse import ArgumentParser\n'), ((1786, 1803), 'os.mkdir', 'os.mkdir', (['"""libc/"""'], {}), "('libc/')\n", (1794, 1803), False, 'import os\n'), ((4603, 4626), 'os.path.isdir', 'os.path.isdir', (['arg.path'], {}),... |
import copy as cp
from pprint import pprint as pp
from termcolor import colored
from modules.blockchain.block import *
from modules.blockchain.book import *
from modules.blockchain.transaction import *
class BlockChain:
"""BlockChain Object to be added to the chain
:Attributes:
:attr block_chain: All the bloc... | [
"termcolor.colored",
"copy.deepcopy",
"pprint.pprint"
] | [((5174, 5191), 'copy.deepcopy', 'cp.deepcopy', (['self'], {}), '(self)\n', (5185, 5191), True, 'import copy as cp\n'), ((6685, 6711), 'pprint.pprint', 'pp', (['msg'], {'indent': '(4)', 'width': '(4)'}), '(msg, indent=4, width=4)\n', (6687, 6711), True, 'from pprint import pprint as pp\n'), ((6647, 6670), 'termcolor.co... |
from pathlib import Path
from tempfile import TemporaryDirectory
from typing import Any, Dict, List, Tuple
import pytest
from scripts.generate import (
CIRCULAR_PROPERTY_REFERENCES,
CIRCULAR_REFERENCES,
INT_PROPERTIES,
ObjectDefinition,
OneOfDefinition,
PrimitiveDefinition,
Property,
S... | [
"scripts.generate.get_import_line_from_reference",
"tempfile.TemporaryDirectory",
"scripts.generate.Property",
"scripts.generate.ObjectDefinition",
"scripts.generate.get_resource_file_name",
"pytest.raises",
"pathlib.Path",
"scripts.generate.Property.get_enum_literal",
"scripts.generate.get_definiti... | [((2914, 2947), 'scripts.generate.OneOfDefinition', 'OneOfDefinition', (['"""Result"""', 'schema'], {}), "('Result', schema)\n", (2929, 2947), False, 'from scripts.generate import CIRCULAR_PROPERTY_REFERENCES, CIRCULAR_REFERENCES, INT_PROPERTIES, ObjectDefinition, OneOfDefinition, PrimitiveDefinition, Property, Schema,... |
import json
import os
import bottle
import time
from app.api import ping_response, start_response, move_response, end_response
from app.board import update_board
from app.random_snake import random_move
from app.food_snake import food_move
from app.wall_snake import wall_move
from app.smart_snake import smart_move
f... | [
"app.doga_snake.doga_move",
"bottle.default_app",
"bottle.static_file",
"app.api.ping_response",
"app.api.move_response",
"bottle.route",
"app.board.update_board",
"app.api.end_response",
"os.getenv",
"bottle.post",
"app.api.start_response"
] | [((373, 390), 'bottle.route', 'bottle.route', (['"""/"""'], {}), "('/')\n", (385, 390), False, 'import bottle\n'), ((468, 503), 'bottle.route', 'bottle.route', (['"""/static/<path:path>"""'], {}), "('/static/<path:path>')\n", (480, 503), False, 'import bottle\n'), ((579, 599), 'bottle.post', 'bottle.post', (['"""/ping"... |
import os
import pandas as pd
import pdb
import seaborn as sns
import matplotlib.pyplot as plt
#import pymrmr
from scipy.stats import kendalltau, pearsonr, spearmanr
from sklearn.feature_selection import SelectKBest, mutual_info_classif, chi2, f_classif, RFE
import numpy as np
# Feature Importance Sklearn
# https://ma... | [
"pandas.DataFrame",
"numpy.sum",
"seaborn.heatmap",
"matplotlib.pyplot.show",
"sklearn.feature_selection.RFE",
"scipy.stats.spearmanr",
"scipy.stats.pearsonr",
"matplotlib.pyplot.figure",
"pdb.set_trace",
"scipy.stats.kendalltau",
"sklearn.feature_selection.SelectKBest",
"pandas.concat"
] | [((804, 881), 'pandas.DataFrame', 'pd.DataFrame', (["{'column_name': df.columns, 'percent_missing': percent_missing}"], {}), "({'column_name': df.columns, 'percent_missing': percent_missing})\n", (816, 881), True, 'import pandas as pd\n'), ((1598, 1665), 'sklearn.feature_selection.SelectKBest', 'SelectKBest', ([], {'sc... |
#########
11/15/2021
#Generating a dataset for only categorical
df_categorical = df.select_dtypes(exclude=['number'])
df_categorical=df_categorical.drop(['Date.of.Birth','DisbursalDate'],axis=1)
df_categorical.head()
#Building a Dataset for numerical (continous)
df_continuous = df.select_dtypes(include=['number'])
df... | [
"matplotlib.pyplot.show",
"seaborn.color_palette"
] | [((788, 798), 'matplotlib.pyplot.show', 'plt.show', ([], {}), '()\n', (796, 798), True, 'import matplotlib.pyplot as plt\n'), ((905, 915), 'matplotlib.pyplot.show', 'plt.show', ([], {}), '()\n', (913, 915), True, 'import matplotlib.pyplot as plt\n'), ((1001, 1011), 'matplotlib.pyplot.show', 'plt.show', ([], {}), '()\n'... |
# -*- coding:utf-8 -*-
from django.db import models
from django.contrib.auth.models import User
BRANCHE_CHOICES = (
(1, u"Lutins"),
(2, u"Louveteaux"),
(3, u"Éclés"),
(4, u"Aînés"),
)
EXPLOGRAM_CHOICES = (
(1, u"Le pont des cultures"),
(2, u"On est cap !"),
(3, u"Filles/garçons"),
(4... | [
"django.db.models.FileField",
"django.db.models.NullBooleanField",
"django.db.models.TextField",
"django.db.models.OneToOneField",
"django.db.models.CharField",
"django.db.models.ForeignKey",
"django.db.models.PositiveIntegerField",
"django.db.models.BooleanField",
"django.db.models.ImageField",
"... | [((388, 444), 'django.db.models.IntegerField', 'models.IntegerField', (['u"""Branche"""'], {'choices': 'BRANCHE_CHOICES'}), "(u'Branche', choices=BRANCHE_CHOICES)\n", (407, 444), False, 'from django.db import models\n'), ((455, 515), 'django.db.models.CharField', 'models.CharField', (['u"""Nom de l\'unité/équipage"""']... |
from phrase_similarity import dedup_by_embedding, dedup_by_stemming
# Test1
result1 = dedup_by_stemming(['civilization', 'civil', 'computer'])
sol1 = ['civilization', 'computer']
if result1 == sol1:
print("Test 1 Passed")
else:
print("Test 1 Failed")
print(result1)
exit()
#Test 2
result... | [
"phrase_similarity.dedup_by_stemming",
"phrase_similarity.dedup_by_embedding"
] | [((90, 146), 'phrase_similarity.dedup_by_stemming', 'dedup_by_stemming', (["['civilization', 'civil', 'computer']"], {}), "(['civilization', 'civil', 'computer'])\n", (107, 146), False, 'from phrase_similarity import dedup_by_embedding, dedup_by_stemming\n'), ((324, 571), 'phrase_similarity.dedup_by_embedding', 'dedup_... |
import xlwt
from django.shortcuts import get_object_or_404, HttpResponse
from django.urls import reverse_lazy
from django.utils.datetime_safe import datetime
from django.views.generic import DetailView, ListView, UpdateView, DeleteView, TemplateView
# Create your views here.
from employee_information_site.models import... | [
"vacation_schedule.models.EmployeeVacationPeriod.objects.all",
"xlwt.Workbook",
"vacation_schedule.models.EmployeeVacationPeriod._meta.get_fields",
"django.shortcuts.HttpResponse",
"django.urls.reverse_lazy",
"employee_information_site.models.Employee.objects.filter",
"django.shortcuts.get_object_or_404... | [((1482, 1532), 'django.urls.reverse_lazy', 'reverse_lazy', (['"""vacation_schedule:vacationListPage"""'], {}), "('vacation_schedule:vacationListPage')\n", (1494, 1532), False, 'from django.urls import reverse_lazy\n'), ((4471, 4521), 'django.urls.reverse_lazy', 'reverse_lazy', (['"""vacation_schedule:vacationListPage"... |
import cv2 # DO NOT REMOVE
from datasets import SceneData, ScenesDataSet
import train
from utils import general_utils, path_utils
from utils.Phases import Phases
import torch
def train_single_model(conf, device, phase):
# Create data
scene_data = SceneData.create_scene_data(conf)
# Create model
mode... | [
"datasets.ScenesDataSet.ScenesDataSet",
"utils.path_utils.path_to_model",
"datasets.ScenesDataSet.DataLoader",
"torch.load",
"datasets.SceneData.create_scene_data",
"utils.general_utils.write_results",
"train.train",
"datasets.SceneData.get_subset",
"utils.general_utils.init_exp"
] | [((258, 291), 'datasets.SceneData.create_scene_data', 'SceneData.create_scene_data', (['conf'], {}), '(conf)\n', (285, 291), False, 'from datasets import SceneData, ScenesDataSet\n'), ((1498, 1556), 'datasets.ScenesDataSet.ScenesDataSet', 'ScenesDataSet.ScenesDataSet', (['[scene_data]'], {'return_all': '(True)'}), '([s... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Tue Jan 30 07:05:07 2018
@author: massimo
"""
from brightway2 import *
import pandas as pd
import numpy as np
from matplotlib import pyplot as plt
from scipy import stats
projects
projects.set_current('bw2_import_ecoinvent_3.4')
databases
db = Database("... | [
"pandas.DataFrame",
"numpy.log",
"matplotlib.pyplot.plot",
"matplotlib.pyplot.hist",
"scipy.stats.ttest_rel",
"scipy.stats.shapiro",
"matplotlib.pyplot.ylabel",
"scipy.stats.wilcoxon",
"matplotlib.pyplot.xlabel"
] | [((646, 680), 'matplotlib.pyplot.hist', 'plt.hist', (['mc_results'], {'density': '(True)'}), '(mc_results, density=True)\n', (654, 680), True, 'from matplotlib import pyplot as plt\n'), ((681, 706), 'matplotlib.pyplot.ylabel', 'plt.ylabel', (['"""Probability"""'], {}), "('Probability')\n", (691, 706), True, 'from matpl... |
from network import Regressor, Loss_gamma_0_6
import numpy as np
import skorch
from skorch import NeuralNetRegressor
from torch import optim
def load_model(load_cp, n_in=106,device='cuda'):
cp = skorch.callbacks.Checkpoint(dirname=load_cp)
net = NeuralNetRegressor(
Regressor(n_in=n_in),
criter... | [
"skorch.callbacks.Checkpoint",
"numpy.save",
"network.Regressor"
] | [((201, 245), 'skorch.callbacks.Checkpoint', 'skorch.callbacks.Checkpoint', ([], {'dirname': 'load_cp'}), '(dirname=load_cp)\n', (228, 245), False, 'import skorch\n'), ((1112, 1145), 'numpy.save', 'np.save', (['"""model_paras.npy"""', 'paras'], {}), "('model_paras.npy', paras)\n", (1119, 1145), True, 'import numpy as n... |
import numpy as np
from gensim.models import Word2Vec
from src.utils import io
def run(
random_walk_files, output_file, dimensions=128, context_size=10, epochs=1, workers=1
):
"""Generates node vector embeddings from a list of files containing random
walks performed on different layers of a multilayer net... | [
"src.utils.io.read_random_walks",
"gensim.models.Word2Vec",
"numpy.split"
] | [((1109, 1140), 'numpy.split', 'np.split', (['walks', 'walks.shape[0]'], {}), '(walks, walks.shape[0])\n', (1117, 1140), True, 'import numpy as np\n'), ((1248, 1360), 'gensim.models.Word2Vec', 'Word2Vec', (['walks_trim'], {'size': 'dimensions', 'window': 'context_size', 'min_count': '(0)', 'sg': '(1)', 'workers': 'work... |
"""Class representing the object being modeled."""
import json
import logging
import re
from pathlib import Path
from typing import Dict, List, Tuple, Union
from natsort import natsorted
from openpyxl import load_workbook
class PartObject:
""" Load and create a part from a source """
def __init__(self, pins... | [
"json.dump",
"re.split",
"re.match",
"openpyxl.load_workbook",
"logging.getLogger",
"pathlib.Path",
"re.findall",
"natsort.natsorted"
] | [((379, 414), 'logging.getLogger', 'logging.getLogger', (['"""partmap.object"""'], {}), "('partmap.object')\n", (396, 414), False, 'import logging\n'), ((532, 546), 'pathlib.Path', 'Path', (['filename'], {}), '(filename)\n', (536, 546), False, 'from pathlib import Path\n'), ((723, 746), 'openpyxl.load_workbook', 'load_... |
#!/usr/bin/env python
'Turbobil agi Asterisk'
__author__ = "<NAME>"
__version__ = "0.1.2"
__email__ = "<EMAIL>"
import os
import sys
from turbodb import *
import logging
from agi import *
from dialer import *
#Type pay
PRE_PAY = 1
POST_PAY = 2
# INFO, DEBUG, WARNING, CRITICAL, ERROR
def set_logging(cfg_leve... | [
"logging.error",
"logging.basicConfig",
"logging.StreamHandler",
"logging.getLogger",
"logging.Formatter",
"logging.info",
"sys.exit"
] | [((342, 378), 'logging.basicConfig', 'logging.basicConfig', ([], {'level': 'cfg_level'}), '(level=cfg_level)\n', (361, 378), False, 'import logging\n'), ((399, 477), 'logging.Formatter', 'logging.Formatter', (['"""%(asctime)s [%(threadName)s] [%(levelname)s] %(message)s"""'], {}), "('%(asctime)s [%(threadName)s] [%(le... |
import pygame, assets
from options import OptionsScreen
class TitleScreen:
def __init__(self, screen):
self.screen = screen
big_font = pygame.font.SysFont(assets.font, 90)
small_font = pygame.font.SysFont(assets.font, 24)
self.heading = small_font.render("Super Extreme", True, (255,255,255))
self.titl... | [
"options.OptionsScreen",
"assets.background.draw",
"assets.background.logic",
"pygame.font.SysFont"
] | [((144, 180), 'pygame.font.SysFont', 'pygame.font.SysFont', (['assets.font', '(90)'], {}), '(assets.font, 90)\n', (163, 180), False, 'import pygame, assets\n'), ((196, 232), 'pygame.font.SysFont', 'pygame.font.SysFont', (['assets.font', '(24)'], {}), '(assets.font, 24)\n', (215, 232), False, 'import pygame, assets\n'),... |
import random
import math
from PIL import Image
def sample(x, y, num_of_sample_directions=64):
s = 0.0
for i in range(num_of_sample_directions):
# random_rad = 2 * math.pi * random.uniform(0.0, 1.0)
random_rad = 2 * math.pi * (i + random.uniform(0.0, 1.0)) / num_of_sample_directions
s +... | [
"PIL.Image.new",
"math.sqrt",
"random.uniform",
"math.sin",
"math.cos"
] | [((967, 998), 'PIL.Image.new', 'Image.new', (['"""L"""', '(width, height)'], {}), "('L', (width, height))\n", (976, 998), False, 'from PIL import Image\n'), ((857, 909), 'math.sqrt', 'math.sqrt', (['((x - cx) * (x - cx) + (y - cy) * (y - cy))'], {}), '((x - cx) * (x - cx) + (y - cy) * (y - cy))\n', (866, 909), False, '... |
from pymongo.errors import BulkWriteError
import logging
import time
import tqdm
import tweepy
logging.basicConfig(format='[%(asctime)s] - %(name)s - %(funcName)s - %(levelname)s : %(message)s', level=logging.INFO)
log = logging.getLogger(__name__)
def bulk_write_to_mongo(collection, data):
to_insert = len(data)
... | [
"logging.getLogger",
"tweepy.Cursor",
"logging.basicConfig",
"time.time"
] | [((96, 224), 'logging.basicConfig', 'logging.basicConfig', ([], {'format': '"""[%(asctime)s] - %(name)s - %(funcName)s - %(levelname)s : %(message)s"""', 'level': 'logging.INFO'}), "(format=\n '[%(asctime)s] - %(name)s - %(funcName)s - %(levelname)s : %(message)s',\n level=logging.INFO)\n", (115, 224), False, 'im... |
from typing import Callable
from tensorflow.python.layers import base
from tensorflow.python.eager import context
from tensorflow.python.estimator import util as estimator_util
from tensorflow.python.framework import dtypes
from tensorflow.python.framework import ops
from tensorflow.python.framework import tensor_sha... | [
"tensorflow.cond",
"tensorflow.contrib.seq2seq.tile_batch",
"tensorflow.gather_nd",
"tensorflow.reshape",
"tensorflow.python.layers.base.InputSpec",
"tensorflow.python.framework.tensor_shape.TensorShape",
"tensorflow.greater_equal",
"tensorflow.greater",
"tensorflow.split",
"tensorflow.scatter_nd"... | [((15151, 15179), 'tensorflow.python.ops.init_ops.zeros_initializer', 'init_ops.zeros_initializer', ([], {}), '()\n', (15177, 15179), False, 'from tensorflow.python.ops import init_ops\n'), ((18328, 18339), 'sys.exit', 'sys.exit', (['(0)'], {}), '(0)\n', (18336, 18339), False, 'import sys\n'), ((4482, 4510), 'tensorflo... |
import math
import pytest
from e3nn.math import perm
@pytest.mark.parametrize('n', [0, 1, 2, 3, 4, 5])
def test_inverse(n):
for p in perm.group(n):
ip = perm.inverse(p)
assert perm.compose(p, ip) == perm.identity(n)
assert perm.compose(ip, p) == perm.identity(n)
@pytest.mark.parametri... | [
"e3nn.math.perm.compose",
"e3nn.math.perm.germinate",
"e3nn.math.perm.from_int",
"e3nn.math.perm.group",
"e3nn.math.perm.inverse",
"e3nn.math.perm.to_int",
"math.factorial",
"e3nn.math.perm.is_group",
"pytest.mark.parametrize",
"e3nn.math.perm.rand",
"e3nn.math.perm.identity"
] | [((58, 106), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""n"""', '[0, 1, 2, 3, 4, 5]'], {}), "('n', [0, 1, 2, 3, 4, 5])\n", (81, 106), False, 'import pytest\n'), ((299, 347), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""n"""', '[0, 1, 2, 3, 4, 5]'], {}), "('n', [0, 1, 2, 3, 4, 5])\n", (322... |
from typing import Generic, Optional, TypeVar
from abc import ABCMeta, abstractmethod
from datetime import datetime, timedelta
import logging
from crontab import CronTab
from dateutil.relativedelta import *
from django.db import transaction
from django.utils import timezone
from processes.common.reque... | [
"processes.models.Schedulable.CRON_REGEX.match",
"django.utils.timezone.now",
"processes.models.Schedulable.RATE_REGEX.match",
"crontab.CronTab",
"datetime.timedelta",
"typing.TypeVar",
"django.db.transaction.atomic",
"processes.common.request_helpers.context_with_request",
"logging.getLogger"
] | [((660, 687), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (677, 687), False, 'import logging\n'), ((712, 758), 'typing.TypeVar', 'TypeVar', (['"""BoundSchedulable"""'], {'bound': 'Schedulable'}), "('BoundSchedulable', bound=Schedulable)\n", (719, 758), False, 'from typing import Generi... |
import liblo
import time
addresses = [liblo.Address("192.168.1.3","2222"),liblo.Address("192.168.1.4","2222"),liblo.Address("192.168.1.5","2222"),liblo.Address("192.168.1.6","2222"),liblo.Address("192.168.1.7","2222"),liblo.Address("192.168.1.8","2222"),liblo.Address("192.168.1.9","2222"),liblo.Address("192.168.1.1... | [
"liblo.send",
"liblo.Address"
] | [((42, 78), 'liblo.Address', 'liblo.Address', (['"""192.168.1.3"""', '"""2222"""'], {}), "('192.168.1.3', '2222')\n", (55, 78), False, 'import liblo\n'), ((78, 114), 'liblo.Address', 'liblo.Address', (['"""192.168.1.4"""', '"""2222"""'], {}), "('192.168.1.4', '2222')\n", (91, 114), False, 'import liblo\n'), ((114, 150)... |
import numpy as np
import abc
class ProbabilityDistribution(abc.ABC):
"""
Class representing the interface for a probability distribution
"""
@abc.abstractmethod
def sample(self, size):
"""
This method must return an array with length "size", sampling the distribution
# A... | [
"numpy.random.normal",
"numpy.fromiter"
] | [((987, 1032), 'numpy.random.normal', 'np.random.normal', (['self._mean', 'self._std', 'size'], {}), '(self._mean, self._std, size)\n', (1003, 1032), True, 'import numpy as np\n'), ((2570, 2607), 'numpy.fromiter', 'np.fromiter', (['values'], {'dtype': 'np.float64'}), '(values, dtype=np.float64)\n', (2581, 2607), True, ... |
import tensorflow as tf
import numpy as np
import matplotlib
matplotlib.use('agg')
import matplotlib.pyplot as plt
import matplotlib.gridspec as gridspec
import copy
from morphodynamics.landscapes.utils import get_meshgrid
from morphodynamics.landscapes.analysis.get_fields import *
from morphodynamics.landscapes.analy... | [
"copy.deepcopy",
"tensorflow.convert_to_tensor",
"tensorflow.concat",
"numpy.log10",
"matplotlib.pyplot.figure",
"matplotlib.use",
"numpy.array",
"morphodynamics.landscapes.utils.get_meshgrid",
"numpy.reshape",
"numpy.linspace",
"numpy.max",
"matplotlib.gridspec.GridSpec",
"numpy.gradient",
... | [((61, 82), 'matplotlib.use', 'matplotlib.use', (['"""agg"""'], {}), "('agg')\n", (75, 82), False, 'import matplotlib\n'), ((725, 790), 'morphodynamics.landscapes.utils.get_meshgrid', 'get_meshgrid', (['model.xlims', 'model.ylims', 'model.dims'], {'flatBool': '(True)'}), '(model.xlims, model.ylims, model.dims, flatBool... |
# Copyright 2019 <NAME>. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agree... | [
"clispy.parser.Parser.parse"
] | [((1571, 1603), 'clispy.parser.Parser.parse', 'Parser.parse', (['"""(NAME (+ 1 2 3))"""'], {}), "('(NAME (+ 1 2 3))')\n", (1583, 1603), False, 'from clispy.parser import Parser\n'), ((2411, 2461), 'clispy.parser.Parser.parse', 'Parser.parse', (['"""(((TEST (X) (* X X X))) (TEST 10))"""'], {}), "('(((TEST (X) (* X X X))... |
from flask import request, Blueprint
from controllers import timelines
from pkg.warpResponse import warpResponse
timeline = Blueprint('timeline', __name__)
@timeline.route("/", methods=['GET'])
def getAllTimelines():
resp, code = timelines.FindAll()
if resp is not None:
return warpResponse(resp)
... | [
"controllers.timelines.FindAllWithCond",
"flask.Blueprint",
"pkg.warpResponse.warpResponse",
"controllers.timelines.Create",
"controllers.timelines.FindOne",
"controllers.timelines.FindAll",
"controllers.timelines.Patch",
"flask.request.get_json"
] | [((126, 157), 'flask.Blueprint', 'Blueprint', (['"""timeline"""', '__name__'], {}), "('timeline', __name__)\n", (135, 157), False, 'from flask import request, Blueprint\n'), ((238, 257), 'controllers.timelines.FindAll', 'timelines.FindAll', ([], {}), '()\n', (255, 257), False, 'from controllers import timelines\n'), ((... |
from __future__ import absolute_import, division, print_function
import os
import glob
from glue.logger import logger
from glue.core.data import Data
from glue.config import data_factory
import vaex.hdf5.dataset
from .data import DataVaex
def is_vaex_file(source):
return vaex.hdf5.dataset.Hdf5MemoryMapped.can_o... | [
"os.path.isdir",
"glue.config.data_factory",
"os.path.join",
"glue.core.data.Data"
] | [((335, 423), 'glue.config.data_factory', 'data_factory', ([], {'label': '"""vaex file or directory"""', 'identifier': 'is_vaex_file', 'priority': '(1000)'}), "(label='vaex file or directory', identifier=is_vaex_file,\n priority=1000)\n", (347, 423), False, 'from glue.config import data_factory\n'), ((510, 531), 'os... |
import numpy as np
import inspect
from scipy.linalg import qr as qr_factorization
from copy import deepcopy
from pyapprox.utilities import cartesian_product, outer_product
from pyapprox.univariate_polynomials.quadrature import gauss_jacobi_pts_wts_1D
from pyapprox.barycentric_interpolation import (
compute_barycen... | [
"numpy.empty",
"pyapprox.utilities.qr_solve",
"numpy.ones",
"numpy.linalg.cond",
"pyapprox.barycentric_interpolation.compute_barycentric_weights_1d",
"numpy.arange",
"pyapprox.utilities.cartesian_product",
"numpy.linalg.solve",
"numpy.atleast_2d",
"pylab.plot",
"numpy.kron",
"numpy.linspace",
... | [((807, 858), 'numpy.empty', 'np.empty', (['(matrix_num_rows, matrix_num_rows)', 'float'], {}), '((matrix_num_rows, matrix_num_rows), float)\n', (815, 858), True, 'import numpy as np\n'), ((1327, 1347), 'numpy.array', 'np.array', (['[1]', 'float'], {}), '([1], float)\n', (1335, 1347), True, 'import numpy as np\n'), ((1... |
"""
Codec for serializing and deserializing blob fields.
See `Blob Fields <https://xrpl.org/serialization.html#blob-fields>`_
"""
from __future__ import annotations
from typing import Type
from xrpl.core.binarycodec.binary_wrappers.binary_parser import BinaryParser
from xrpl.core.binarycodec.exceptions import XRPLBin... | [
"xrpl.core.binarycodec.exceptions.XRPLBinaryCodecException"
] | [((1883, 1949), 'xrpl.core.binarycodec.exceptions.XRPLBinaryCodecException', 'XRPLBinaryCodecException', (['"""Cannot construct Blob from value given"""'], {}), "('Cannot construct Blob from value given')\n", (1907, 1949), False, 'from xrpl.core.binarycodec.exceptions import XRPLBinaryCodecException\n'), ((1624, 1747),... |
from __future__ import unicode_literals
from django.utils.encoding import python_2_unicode_compatible
from django.db import models
from django.contrib.auth.models import User
from django.core.urlresolvers import reverse
import time
def user_media_path(instance, filename):
"""
Returns the path to where a use... | [
"django.db.models.TextField",
"django.core.urlresolvers.reverse",
"django.db.models.CharField",
"django.db.models.ForeignKey",
"django.db.models.PositiveIntegerField",
"time.strftime",
"django.db.models.SlugField",
"django.db.models.ImageField",
"django.db.models.DateTimeField"
] | [((728, 760), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(100)'}), '(max_length=100)\n', (744, 760), False, 'from django.db import models\n'), ((775, 793), 'django.db.models.TextField', 'models.TextField', ([], {}), '()\n', (791, 793), False, 'from django.db import models\n'), ((806, 873), '... |
#!/usr/bin/env python3
import gi
# import GStreamer and GLib-Helper classes
gi.require_version('Gtk', '3.0')
gi.require_version('Gst', '1.0')
gi.require_version('GstVideo', '1.0')
gi.require_version('GstNet', '1.0')
from gi.repository import Gtk, Gdk, Gst, GstVideo
import signal
import logging
import sys
import os
sy... | [
"gi.repository.Gtk.Settings.get_default",
"gi.repository.Gdk.Screen.get_default",
"lib.connection.enterNonblockingMode",
"os.path.isfile",
"gi.repository.Gdk.init",
"gi.repository.Gtk.main_quit",
"lib.config.Config.getHost",
"gi.repository.Gtk.init",
"lib.args.parse",
"sys.stderr.isatty",
"lib.c... | [((76, 108), 'gi.require_version', 'gi.require_version', (['"""Gtk"""', '"""3.0"""'], {}), "('Gtk', '3.0')\n", (94, 108), False, 'import gi\n'), ((109, 141), 'gi.require_version', 'gi.require_version', (['"""Gst"""', '"""1.0"""'], {}), "('Gst', '1.0')\n", (127, 141), False, 'import gi\n'), ((142, 179), 'gi.require_vers... |
"""
Setup module.
"""
import re
from os.path import join as pjoin
from setuptools import setup
with open(pjoin('diapason', '__init__.py')) as f:
line = next(l for l in f if l.startswith('__version__'))
version = re.match('__version__ = [\'"]([^\'"]+)[\'"]', line).group(1)
setup(
name='diapason',
vers... | [
"re.match",
"os.path.join",
"setuptools.setup"
] | [((284, 1379), 'setuptools.setup', 'setup', ([], {'name': '"""diapason"""', 'version': 'version', 'description': '"""Python module to deal with note sounds."""', 'long_description': '"""The diapason Python module can be used to deal with\n note sounds: WAV generation, note frequency calculation..."""', 'url': '"... |
#!/usr/bin/env python3
import os
import sys
from Bio import SeqIO
from Bio.Seq import Seq
def insilico_trypsinized(seq) :
segments = []
seg = []
for i in range(len(seq)) :
if seq[i] in ('K','R') :
if i == len(seq)-1 :
seg.append(seq[i])
elif seq[i+1] == 'P'... | [
"os.path.split",
"Bio.SeqIO.parse",
"os.path.basename"
] | [((1840, 1864), 'Bio.SeqIO.parse', 'SeqIO.parse', (['fp', '"""fasta"""'], {}), "(fp, 'fasta')\n", (1851, 1864), False, 'from Bio import SeqIO\n'), ((1699, 1716), 'os.path.split', 'os.path.split', (['fa'], {}), '(fa)\n', (1712, 1716), False, 'import os\n'), ((1739, 1759), 'os.path.basename', 'os.path.basename', (['fa'],... |
import re
import unittest
from functools import partial
from pycyqle.builder import dict_build, param_build
from pycyqle.factory import Component, Factory
class FactoryTest(unittest.TestCase):
def test_param_build(self):
factory = param_build(
Factory,
name='bicycle-... | [
"unittest.main",
"functools.partial",
"pycyqle.builder.dict_build",
"pycyqle.builder.param_build"
] | [((2523, 2538), 'unittest.main', 'unittest.main', ([], {}), '()\n', (2536, 2538), False, 'import unittest\n'), ((258, 337), 'pycyqle.builder.param_build', 'param_build', (['Factory'], {'name': '"""bicycle-factory"""', 'table': '"""bicycle"""', 'primary_key': '"""id"""'}), "(Factory, name='bicycle-factory', table='bicyc... |
import firebase_admin
from firebase_admin import credentials, messaging
file_path = './pycon-monitoring-workshop-firebase-adminsdk.json'
cred = credentials.Certificate(file_path)
default_app = firebase_admin.initialize_app(cred)
def send_message(recipients, message, dry_run=False):
if not isinstance(recipients,... | [
"firebase_admin.initialize_app",
"firebase_admin.credentials.Certificate",
"firebase_admin.messaging.send"
] | [((146, 180), 'firebase_admin.credentials.Certificate', 'credentials.Certificate', (['file_path'], {}), '(file_path)\n', (169, 180), False, 'from firebase_admin import credentials, messaging\n'), ((195, 230), 'firebase_admin.initialize_app', 'firebase_admin.initialize_app', (['cred'], {}), '(cred)\n', (224, 230), False... |
from influxdb import InfluxDBClient
class Global_Influx():
Client_all = InfluxDBClient(host='172.16.20.190',port=8086,username='voicecomm',password='<PASSWORD>')
| [
"influxdb.InfluxDBClient"
] | [((76, 172), 'influxdb.InfluxDBClient', 'InfluxDBClient', ([], {'host': '"""172.16.20.190"""', 'port': '(8086)', 'username': '"""voicecomm"""', 'password': '"""<PASSWORD>"""'}), "(host='172.16.20.190', port=8086, username='voicecomm',\n password='<PASSWORD>')\n", (90, 172), False, 'from influxdb import InfluxDBClien... |
# -*- coding: utf-8 -*-
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.image as img
from sklearn.decomposition import TruncatedSVD
"""
打个比方说一张女人图片,我们如何判定这个女人是不是美女呢。我们会看比较关键的一些特征,比如说脸好不好看,胸好不好看,屁股怎么样,腿怎么样,至于衣服上是某个花纹还是手臂上有一个小痔还是,这些特征我们都是不关心的,就可以过滤掉。我们关心的是主成分,也就是对结果贡献系数较大的特征。SVD算法的作用就是来告诉你哪些特征是重要的,... | [
"numpy.dstack",
"matplotlib.image.imread",
"matplotlib.pyplot.show",
"sklearn.decomposition.TruncatedSVD",
"matplotlib.pyplot.imshow",
"numpy.array",
"numpy.reshape"
] | [((511, 534), 'matplotlib.image.imread', 'img.imread', (['"""test2.png"""'], {}), "('test2.png')\n", (521, 534), True, 'import matplotlib.image as img\n'), ((676, 695), 'numpy.array', 'np.array', (['img_array'], {}), '(img_array)\n', (684, 695), True, 'import numpy as np\n'), ((1170, 1187), 'numpy.dstack', 'np.dstack',... |
from scipy.stats import uniform
import numpy as np
import matplotlib.pyplot as plt
from scipy.optimize import minimize
from scipy.stats import exponweib
def calculate_parameters(interarrivals):
sample = np.array(interarrivals)
x = np.linspace(0, 1 - 1 / sample.shape[0], sample.shape[0])
x = x[sample > 0... | [
"matplotlib.pyplot.show",
"numpy.log",
"matplotlib.pyplot.twinx",
"numpy.array",
"numpy.exp",
"numpy.linspace",
"scipy.stats.exponweib",
"matplotlib.pyplot.subplots"
] | [((211, 234), 'numpy.array', 'np.array', (['interarrivals'], {}), '(interarrivals)\n', (219, 234), True, 'import numpy as np\n'), ((243, 299), 'numpy.linspace', 'np.linspace', (['(0)', '(1 - 1 / sample.shape[0])', 'sample.shape[0]'], {}), '(0, 1 - 1 / sample.shape[0], sample.shape[0])\n', (254, 299), True, 'import nump... |
# coding: utf-8
import sys
import os
import flask
from flask import redirect,request,render_template_string,render_template
from werkzeug.utils import secure_filename
import importlib
import zipfile
import threading
import random
from datetime import datetime
import pytz
import time
from sqlalchemy import... | [
"os.path.abspath",
"importlib.import_module",
"flask.redirect",
"os.path.dirname",
"flask.Flask",
"os.path.join"
] | [((580, 601), 'flask.Flask', 'flask.Flask', (['__name__'], {}), '(__name__)\n', (591, 601), False, 'import flask\n'), ((613, 649), 'importlib.import_module', 'importlib.import_module', (['"""wsgi_util"""'], {}), "('wsgi_util')\n", (636, 649), False, 'import importlib\n'), ((489, 514), 'os.path.abspath', 'os.path.abspat... |
from pyspark.sql import SparkSession
if __name__ == "__main__":
# input = sample_warc_loc
spark: SparkSession = SparkSession.builder \
.appName('Activity 2.1') \
.getOrCreate()
spark.sparkContext.setLogLevel('ERROR') # avoids printing of info messages
from operator import add
f... | [
"pyspark.sql.SparkSession.builder.appName",
"Chapter02.utilities02_py.helper_python.extract_raw_records",
"Chapter02.utilities02_py.helper_python.parse_raw_warc"
] | [((124, 168), 'pyspark.sql.SparkSession.builder.appName', 'SparkSession.builder.appName', (['"""Activity 2.1"""'], {}), "('Activity 2.1')\n", (152, 168), False, 'from pyspark.sql import SparkSession\n'), ((566, 599), 'Chapter02.utilities02_py.helper_python.extract_raw_records', 'extract_raw_records', (['input', 'spark'... |
from abc import ABC, abstractmethod
from crawler_magazine.downloader.asynchronous import AsyncDownloader
class CrawlerInterface(ABC):
def __init__(self, url):
self.url = url
self.downloader = AsyncDownloader()
async def get_page(self, url=None):
return await self.downloader.get(url o... | [
"crawler_magazine.downloader.asynchronous.AsyncDownloader"
] | [((215, 232), 'crawler_magazine.downloader.asynchronous.AsyncDownloader', 'AsyncDownloader', ([], {}), '()\n', (230, 232), False, 'from crawler_magazine.downloader.asynchronous import AsyncDownloader\n')] |
import pymysql, json
from model.sql import Connection
class DeviceModel():
def create_device(self, allowed, blocked, unknown):
sql = "INSERT INTO `device` (`allowed_devices`, `blocked_devices`, `unknown_devices`) VALUES (%s, %s, %s)"
values = (allowed, blocked, unknown)
conn = Connection()... | [
"model.sql.Connection"
] | [((308, 320), 'model.sql.Connection', 'Connection', ([], {}), '()\n', (318, 320), False, 'from model.sql import Connection\n'), ((465, 477), 'model.sql.Connection', 'Connection', ([], {}), '()\n', (475, 477), False, 'from model.sql import Connection\n')] |
import os
import subprocess
import uuid
class CfnStackValidation:
@classmethod
def validate_config(cls, config):
"""Validate section of the stack config"""
if "aws" not in config:
raise KeyError("aws is required in a stack definition")
else:
cls._validate_aws_co... | [
"os.path.isdir",
"uuid.uuid1",
"os.remove",
"os.path.expanduser"
] | [((1377, 1400), 'os.remove', 'os.remove', (['tmp_location'], {}), '(tmp_location)\n', (1386, 1400), False, 'import os\n'), ((3903, 3932), 'os.path.expanduser', 'os.path.expanduser', (['file_path'], {}), '(file_path)\n', (3921, 3932), False, 'import os\n'), ((3682, 3714), 'os.path.isdir', 'os.path.isdir', (["lambd['loca... |
from __future__ import print_function
from math import fabs
from math import sqrt
__author__ = ["<NAME>"]
__copyright__ = "Copyright 2020, Design Machine Group - University of Washington"
__license__ = "MIT License"
__email__ = "<EMAIL>"
__version__ = "0.1.0"
def midpoint_point_point(a, b):
return [0.5 * (a[0] ... | [
"math.fabs"
] | [((7233, 7243), 'math.fabs', 'fabs', (['cosa'], {}), '(cosa)\n', (7237, 7243), False, 'from math import fabs\n'), ((8457, 8467), 'math.fabs', 'fabs', (['cosa'], {}), '(cosa)\n', (8461, 8467), False, 'from math import fabs\n')] |
# -*- coding: utf-8 -*-
# ---------------------------------------------------------------------------
# Defin_Projection_GB_for_folder.py
# Created on: 2015-04-04 12:22:48.00000
# (generated by ArcGIS/ModelBuilder)
# Description:
# ---------------------------------------------------------------------------
# Import ... | [
"arcpy.GetParameter",
"arcpy.ListFeatureClasses",
"arcpy.DefineProjection_management",
"arcpy.GetParameterAsText"
] | [((394, 421), 'arcpy.GetParameterAsText', 'arcpy.GetParameterAsText', (['(0)'], {}), '(0)\n', (418, 421), False, 'import arcpy\n'), ((528, 554), 'arcpy.ListFeatureClasses', 'arcpy.ListFeatureClasses', ([], {}), '()\n', (552, 554), False, 'import arcpy\n'), ((575, 596), 'arcpy.GetParameter', 'arcpy.GetParameter', (['(1)... |
# coding: utf-8
"""
Implementation of validate(instance, schema)
"""
import re
import datetime
import typing
from ...logic import actions, objects, datatypes
from ..errors import ObjectDoesNotExistError, ValidationError, ValidationMultiError
from .utils import units_are_valid
def validate(instance: typing.Union[dic... | [
"datetime.datetime.strptime",
"re.match"
] | [((11580, 11653), 'datetime.datetime.strptime', 'datetime.datetime.strptime', (["instance['utc_datetime']", '"""%Y-%m-%d %H:%M:%S"""'], {}), "(instance['utc_datetime'], '%Y-%m-%d %H:%M:%S')\n", (11606, 11653), False, 'import datetime\n'), ((10227, 10272), 're.match', 're.match', (["schema['pattern']", "instance['text']... |
#!/usr/bin/env python
# coding: utf-8
# In[1]:
import networkx as nx
import numpy as np
import matplotlib.pyplot as plt
import time
# In[2]:
def createGraph(depotNodes ,requiredEdges, numNodes, show=True):
G = nx.Graph()
edges = []
pos = {}
reqPos = {}
s = [1, 1, 2, 2, 3, 3, 4, 4, 4, 5, 6, 7]... | [
"matplotlib.pyplot.show",
"networkx.draw_networkx_edges",
"networkx.dijkstra_path_length",
"matplotlib.pyplot.legend",
"networkx.get_edge_attributes",
"networkx.draw_networkx",
"time.time",
"numpy.argmin",
"networkx.dijkstra_path",
"matplotlib.pyplot.figure",
"networkx.Graph",
"numpy.array",
... | [((221, 231), 'networkx.Graph', 'nx.Graph', ([], {}), '()\n', (229, 231), True, 'import networkx as nx\n'), ((979, 1014), 'networkx.get_edge_attributes', 'nx.get_edge_attributes', (['G', '"""weight"""'], {}), "(G, 'weight')\n", (1001, 1014), True, 'import networkx as nx\n'), ((1018, 1065), 'networkx.draw_networkx', 'nx... |
import ffmpy, subprocess, json
import argparse
def main():
# Globals in Python are global to a module, not across all modules.
# global validDatesDict
# global stripDates
# TODO: use command line parameters to determine path to scan
# https://stackabuse.com/command-line-arguments-in-python/
... | [
"json.loads",
"argparse.ArgumentParser",
"json.dumps",
"ffmpy.FFprobe"
] | [((329, 381), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""checkmetadata"""'}), "(description='checkmetadata')\n", (352, 381), False, 'import argparse\n'), ((925, 1010), 'ffmpy.FFprobe', 'ffmpy.FFprobe', ([], {'global_options': '"""-show_format -of json"""', 'inputs': '{args.input: Non... |
from unittest import mock
from django.test import TestCase
from django.contrib.auth.models import AnonymousUser
import globus_sdk
from globus_portal_framework.utils import load_globus_client
from globus_portal_framework.tests.mocks import (
MockGlobusClient, mock_user, globus_client_is_loaded_with_authorizer
)
... | [
"django.contrib.auth.models.AnonymousUser",
"globus_portal_framework.utils.load_globus_client",
"globus_portal_framework.tests.mocks.globus_client_is_loaded_with_authorizer",
"globus_portal_framework.tests.mocks.mock_user",
"unittest.mock.patch"
] | [((376, 431), 'unittest.mock.patch', 'mock.patch', (['"""globus_sdk.SearchClient"""', 'MockGlobusClient'], {}), "('globus_sdk.SearchClient', MockGlobusClient)\n", (386, 431), False, 'from unittest import mock\n'), ((695, 750), 'unittest.mock.patch', 'mock.patch', (['"""globus_sdk.SearchClient"""', 'MockGlobusClient'], ... |
from django.apps import AppConfig
from django.utils.translation import ugettext_lazy as _
class ArticlesConfig(AppConfig):
name = 'ripiu.cmsplugin_articles'
verbose_name = _('Articles and sections')
| [
"django.utils.translation.ugettext_lazy"
] | [((182, 208), 'django.utils.translation.ugettext_lazy', '_', (['"""Articles and sections"""'], {}), "('Articles and sections')\n", (183, 208), True, 'from django.utils.translation import ugettext_lazy as _\n')] |
from crawler import Downloader, DownloaderError, Worker
from .testing import WorkerTestCase, FakeApp
import asyncio
import aiohttp
from urllib.parse import urljoin
class DownloaderTestCase(WorkerTestCase):
def setUp(self):
super().setUp()
# reset class attribute
Downloader.SEQ_ID = 0
... | [
"asyncio.gather",
"urllib.parse.urljoin",
"asyncio.sleep",
"aiohttp.ClientSession",
"crawler.Downloader",
"asyncio.Queue"
] | [((341, 356), 'asyncio.Queue', 'asyncio.Queue', ([], {}), '()\n', (354, 356), False, 'import asyncio\n'), ((441, 501), 'aiohttp.ClientSession', 'aiohttp.ClientSession', ([], {'headers': "{'User-Agent': 'Test Client'}"}), "(headers={'User-Agent': 'Test Client'})\n", (462, 501), False, 'import aiohttp\n'), ((733, 803), '... |
from transformers import pipeline
import json
sentiment_analysis = pipeline(
"sentiment-analysis",
model="./model",
tokenizer="./model",
return_all_scores = True
)
def handler(event, context):
print('Received event: ' + json.dumps(event, indent=2))
hebrew_text = event['hebrew_text']
resu... | [
"transformers.pipeline",
"json.dumps"
] | [((69, 165), 'transformers.pipeline', 'pipeline', (['"""sentiment-analysis"""'], {'model': '"""./model"""', 'tokenizer': '"""./model"""', 'return_all_scores': '(True)'}), "('sentiment-analysis', model='./model', tokenizer='./model',\n return_all_scores=True)\n", (77, 165), False, 'from transformers import pipeline\n... |
from draw_image import make_image
from twitter_interface import get_twitter_api, fetch_statues
from config import TWITTER_HANDLERS
def run():
api = get_twitter_api()
for handler in TWITTER_HANDLERS:
statues, user = fetch_statues(api, handler, count=20)
for status in statues:
make... | [
"twitter_interface.fetch_statues",
"twitter_interface.get_twitter_api",
"draw_image.make_image"
] | [((154, 171), 'twitter_interface.get_twitter_api', 'get_twitter_api', ([], {}), '()\n', (169, 171), False, 'from twitter_interface import get_twitter_api, fetch_statues\n'), ((234, 271), 'twitter_interface.fetch_statues', 'fetch_statues', (['api', 'handler'], {'count': '(20)'}), '(api, handler, count=20)\n', (247, 271)... |
# -*- coding: utf-8 -*-
from pydatajson.readers import read_catalog
from pydatajson.reporting import generate_datasets_summary
from pydatajson.validators\
.distribution_download_urls_validator \
import DistributionDownloadUrlsValidator
class StatusIndicatorsGenerator(object):
def __init__(self, catalog,... | [
"pydatajson.validators.distribution_download_urls_validator.DistributionDownloadUrlsValidator",
"pydatajson.readers.read_catalog",
"pydatajson.reporting.generate_datasets_summary"
] | [((469, 490), 'pydatajson.readers.read_catalog', 'read_catalog', (['catalog'], {}), '(catalog)\n', (481, 490), False, 'from pydatajson.readers import read_catalog\n'), ((514, 602), 'pydatajson.reporting.generate_datasets_summary', 'generate_datasets_summary', (['self.catalog'], {'validator': 'validator', 'verify_ssl': ... |
class Solution:
def majorityElement(self, nums: List[int]) -> int:
vote = 0
result = None
n = len(nums) // 2
for num in nums:
if vote == 0:
result = num
if result == num:
vote += 1
if vote > n:
... | [
"collections.defaultdict"
] | [((919, 935), 'collections.defaultdict', 'defaultdict', (['int'], {}), '(int)\n', (930, 935), False, 'from collections import defaultdict\n'), ((1527, 1543), 'collections.defaultdict', 'defaultdict', (['int'], {}), '(int)\n', (1538, 1543), False, 'from collections import defaultdict\n')] |
"""
cd G:\GitLab\pdf_extraction\ModularInsurance
python algo1.py
"""
import sys
import random
sys.setrecursionlimit(1500)
print(sys.getrecursionlimit())
def merge_sort(arr,n=None,pivot_index=None):
"""Returns sorted array"""
n = len(arr) if n is None else n
if n==1:
return arr
if n==2:
... | [
"sys.getrecursionlimit",
"sys.setrecursionlimit"
] | [((95, 122), 'sys.setrecursionlimit', 'sys.setrecursionlimit', (['(1500)'], {}), '(1500)\n', (116, 122), False, 'import sys\n'), ((129, 152), 'sys.getrecursionlimit', 'sys.getrecursionlimit', ([], {}), '()\n', (150, 152), False, 'import sys\n')] |
import numpy as np
import pandas as pd
import xarray as xr
from shape import BBox
from .mot import Mot
class BboxMot(Mot):
def __init__(self, **kwargs):
"""
Ground truth stored in xarray.Dataset with frame and id coordinates (frames are 0-indexed).
Example:
<xarray.Dataset>
... | [
"shape.BBox.from_xywh",
"os.rename",
"os.path.exists",
"numpy.isnan",
"datetime.datetime.now"
] | [((2848, 2872), 'os.path.exists', 'os.path.exists', (['filename'], {}), '(filename)\n', (2862, 2872), False, 'import os\n'), ((2957, 3011), 'os.rename', 'os.rename', (['filename', "(filename[:-4] + '_' + dt + '.txt')"], {}), "(filename, filename[:-4] + '_' + dt + '.txt')\n", (2966, 3011), False, 'import os\n'), ((3730,... |
#!/usr/bin/env python3
#
# filter out known vulnerabilities from wiz.io vulnerability report
#
# ./filter_vulnerabilities.py <report_file1> [<report_file2> ...]
#
# usage:
# ./filter_vulnerabilities.py data/vulnerability-reports/1644573599308653316.csv
# ./filter_vulnerabilities.py file1.csv file2.csv
# input fi... | [
"wiz_io_tools.reports_cli.parse_argv",
"os.path.dirname",
"wiz_io_tools.reports_cli.configure_logger",
"logging.getLogger"
] | [((955, 974), 'logging.getLogger', 'logging.getLogger', ([], {}), '()\n', (972, 974), False, 'import logging\n'), ((1007, 1041), 'wiz_io_tools.reports_cli.configure_logger', 'configure_logger', (['LH', 'logging.INFO'], {}), '(LH, logging.INFO)\n', (1023, 1041), False, 'from wiz_io_tools.reports_cli import configure_log... |
from subprocess import Popen, PIPE, STDOUT
import shlex
import time
import sys
import psutil
import os, signal
mod = 'aa' # first good moving camera data generated with carla version 0.97
mod = 'test' # 100 views
#mod = 'ab' # 88 views, yaw 0 to 359nes - 5 sceenes test
mod = 'ac' # 51 views, yaw 0 to 359 - 10 scenes... | [
"psutil.process_iter",
"subprocess.Popen",
"shlex.split",
"time.sleep",
"os.kill"
] | [((1691, 1713), 'shlex.split', 'shlex.split', (['carla_sim'], {}), '(carla_sim)\n', (1702, 1713), False, 'import shlex\n'), ((1754, 1801), 'subprocess.Popen', 'Popen', (['carla_sim_args'], {'stdout': 'PIPE', 'stderr': 'PIPE'}), '(carla_sim_args, stdout=PIPE, stderr=PIPE)\n', (1759, 1801), False, 'from subprocess import... |
# (C) Copyright 2007-2020 Enthought, Inc., Austin, TX
# All rights reserved.
#
# This software is provided without warranty under the terms of the BSD
# license included in LICENSE.txt and may be redistributed only under
# the conditions described in the aforementioned license. The license
# is also available online at... | [
"traits.api.List"
] | [((910, 925), 'traits.api.List', 'List', (['ActionSet'], {}), '(ActionSet)\n', (914, 925), False, 'from traits.api import Interface, List\n')] |
import dofus_protocol as dp
from fm_state import FMState
def packet_handle(pkt: dp.DofusPacket):
state.update(pkt)
state = FMState()
listener = dp.DofusListener(packet_handle)
| [
"fm_state.FMState",
"dofus_protocol.DofusListener"
] | [((128, 137), 'fm_state.FMState', 'FMState', ([], {}), '()\n', (135, 137), False, 'from fm_state import FMState\n'), ((149, 180), 'dofus_protocol.DofusListener', 'dp.DofusListener', (['packet_handle'], {}), '(packet_handle)\n', (165, 180), True, 'import dofus_protocol as dp\n')] |
# This is an auto-generated Django model module.
# You'll have to do the following manually to clean this up:
# * Rearrange models' order
# * Make sure each model has one field with primary_key=True
# * Make sure each ForeignKey has `on_delete` set to the desired behavior.
# * Remove `managed = False` lines if ... | [
"django.db.models.CharField",
"django.db.models.DateTimeField",
"django.db.models.IntegerField"
] | [((643, 686), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(254)', 'null': '(True)'}), '(max_length=254, null=True)\n', (659, 686), False, 'from django.db import models\n'), ((714, 757), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(254)', 'null': '(True)'}), '(max_le... |
from typing import List
import pytest
from backend.biz.policy import InstanceBean, InstanceBeanList, PathNodeBean, PathNodeBeanList
from backend.common.error_codes import APIException
from backend.service.models import PathResourceType, ResourceTypeDict
from backend.service.models.instance_selection import InstanceSe... | [
"backend.biz.policy.InstanceBean",
"backend.biz.policy.PathNodeBean",
"backend.service.models.ResourceTypeDict",
"backend.service.models.instance_selection.InstanceSelection",
"backend.biz.policy.PathNodeBeanList",
"pytest.fixture",
"backend.biz.policy.InstanceBeanList",
"backend.service.models.PathRe... | [((331, 347), 'pytest.fixture', 'pytest.fixture', ([], {}), '()\n', (345, 347), False, 'import pytest\n'), ((521, 537), 'pytest.fixture', 'pytest.fixture', ([], {}), '()\n', (535, 537), False, 'import pytest\n'), ((1667, 1683), 'pytest.fixture', 'pytest.fixture', ([], {}), '()\n', (1681, 1683), False, 'import pytest\n'... |
from robotpy_ext.autonomous import StatefulAutonomous, timed_state, state
class DriveForward(StatefulAutonomous):
DEFAULT = False
MODE_NAME = 'Drive Forward'
def initialize(self):
self.drive.setAutoSetpoint(696.75*10.5*12)
@timed_state(duration=0.5, next_state='drive_forward', first=True... | [
"robotpy_ext.autonomous.state",
"robotpy_ext.autonomous.timed_state"
] | [((256, 321), 'robotpy_ext.autonomous.timed_state', 'timed_state', ([], {'duration': '(0.5)', 'next_state': '"""drive_forward"""', 'first': '(True)'}), "(duration=0.5, next_state='drive_forward', first=True)\n", (267, 321), False, 'from robotpy_ext.autonomous import StatefulAutonomous, timed_state, state\n'), ((427, 47... |
import os
import shutil
class LocalFileStorage(object):
def __init__(self, path):
self.path = path
self.filename = os.path.basename(path)
def list(self, relative=False):
matches = []
for root, dirnames, filenames in os.walk(self.path):
for filename in filenames:
... | [
"os.makedirs",
"os.path.basename",
"os.path.isdir",
"os.path.dirname",
"os.walk",
"os.path.exists",
"os.path.splitext",
"os.path.relpath",
"shutil.copyfile",
"os.path.join"
] | [((138, 160), 'os.path.basename', 'os.path.basename', (['path'], {}), '(path)\n', (154, 160), False, 'import os\n'), ((260, 278), 'os.walk', 'os.walk', (['self.path'], {}), '(self.path)\n', (267, 278), False, 'import os\n'), ((2163, 2185), 'os.path.splitext', 'os.path.splitext', (['path'], {}), '(path)\n', (2179, 2185)... |
from __future__ import print_function
from __future__ import division
from builtins import range
from past.utils import old_div
import os
import numpy as num
from anuga.file.netcdf import NetCDFFile
import pylab as P
import anuga
from anuga.abstract_2d_finite_volumes.mesh_factory import rectangular
from anuga.shallow_... | [
"builtins.range",
"anuga.utilities.numerical_tools.ensure_numeric",
"past.utils.old_div",
"numpy.empty",
"anuga.file.sww.Write_sww",
"numpy.zeros",
"numpy.array",
"anuga.pmesh.mesh.Mesh",
"anuga.file.netcdf.NetCDFFile"
] | [((1240, 1274), 'anuga.file.netcdf.NetCDFFile', 'NetCDFFile', (['stsname', 'netcdf_mode_r'], {}), '(stsname, netcdf_mode_r)\n', (1250, 1274), False, 'from anuga.file.netcdf import NetCDFFile\n'), ((1488, 1519), 'numpy.array', 'num.array', (['[x_origin, y_origin]'], {}), '([x_origin, y_origin])\n', (1497, 1519), True, '... |
from flask import request
from flask_restplus import Resource, fields, Namespace
from app import db
from app.models import Application, Constraints, CounterExample, Model, Result, UserNets, UserProps, \
Verification, get_workdir
from app.schemas import CounterExampleSchema, ModelSchema, ResultSchema, VerificationSc... | [
"app.models.Verification.query.get",
"flask_restplus.fields.Raw",
"flask_restplus.fields.List",
"app.models.get_workdir",
"app.models.Application",
"app.db.session.delete",
"flask_restplus.fields.String",
"app.db.session.commit",
"flask_restplus.Namespace",
"flask.request.get_json"
] | [((668, 681), 'app.models.Application', 'Application', ([], {}), '()\n', (679, 681), False, 'from app.models import Application, Constraints, CounterExample, Model, Result, UserNets, UserProps, Verification, get_workdir\n'), ((695, 755), 'flask_restplus.Namespace', 'Namespace', (['"""models"""'], {'description': '"""mo... |
import json
import pandas as pd
from us import states
from bs4 import BeautifulSoup
import urllib.parse
import json
from can_tools.scrapers import variables
from can_tools.scrapers.official.base import TableauDashboard
from can_tools.scrapers.util import requests_retry_session
class PhiladelphiaVaccine(TableauDashbo... | [
"pandas.DataFrame.from_dict",
"json.loads",
"us.states.lookup",
"can_tools.scrapers.util.requests_retry_session",
"bs4.BeautifulSoup",
"pandas.concat"
] | [((3274, 3298), 'can_tools.scrapers.util.requests_retry_session', 'requests_retry_session', ([], {}), '()\n', (3296, 3298), False, 'from can_tools.scrapers.util import requests_retry_session\n'), ((3838, 3877), 'bs4.BeautifulSoup', 'BeautifulSoup', (['reqg.text', '"""html.parser"""'], {}), "(reqg.text, 'html.parser')\n... |
import sys, time
from PyQt5.QtWidgets import QMainWindow, QWidget, QHBoxLayout, QApplication, QPushButton
class mainwindow(QMainWindow):
def __init__(self):
super(mainwindow, self).__init__()
layout = QHBoxLayout()
w = QWidget()
w.setLayout(layout)
self.setCentralWidget(w)... | [
"PyQt5.QtWidgets.QApplication",
"PyQt5.QtWidgets.QHBoxLayout",
"PyQt5.QtWidgets.QWidget",
"PyQt5.QtWidgets.QPushButton"
] | [((497, 513), 'PyQt5.QtWidgets.QApplication', 'QApplication', (['[]'], {}), '([])\n', (509, 513), False, 'from PyQt5.QtWidgets import QMainWindow, QWidget, QHBoxLayout, QApplication, QPushButton\n'), ((224, 237), 'PyQt5.QtWidgets.QHBoxLayout', 'QHBoxLayout', ([], {}), '()\n', (235, 237), False, 'from PyQt5.QtWidgets im... |
import os
import sys
import unittest
sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), '..')))
from decision_tree import *
from decision_tree import DecisionTree
class DecisionTreeTests(unittest.TestCase):
def test_read_data(self):
result_data = [['FALSE', 'high', 'hot', 'sunn... | [
"unittest.main",
"decision_tree.DecisionTree",
"os.path.dirname",
"decision_tree.DecisionTree.read_libsvm_data"
] | [((5234, 5249), 'unittest.main', 'unittest.main', ([], {}), '()\n', (5247, 5249), False, 'import unittest\n'), ((86, 111), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (101, 111), False, 'import os\n'), ((1150, 1216), 'decision_tree.DecisionTree.read_libsvm_data', 'DecisionTree.read_libsvm_... |
import os
import hashlib
import logging
import traceback
from typing import Union
from xml.etree.ElementTree import Element, SubElement, parse, ElementTree
from xpath_blindeye.xnode import XNode
from xpath_blindeye.util import prettify
from xpath_blindeye.config import ROOT_PATH, URL
logger = logging.getLogger("xpath... | [
"os.mkdir",
"xml.etree.ElementTree.parse",
"traceback.print_exc",
"xpath_blindeye.util.prettify",
"xml.etree.ElementTree.Element",
"xpath_blindeye.xnode.XNode.get_node_name",
"xpath_blindeye.xnode.XNode",
"xpath_blindeye.config.URL.encode",
"xml.etree.ElementTree.SubElement",
"logging.getLogger",
... | [((296, 331), 'logging.getLogger', 'logging.getLogger', (['"""xpath-blindeye"""'], {}), "('xpath-blindeye')\n", (313, 331), False, 'import logging\n'), ((757, 787), 'xpath_blindeye.xnode.XNode.get_node_name', 'XNode.get_node_name', (['root_path'], {}), '(root_path)\n', (776, 787), False, 'from xpath_blindeye.xnode impo... |
from copy import deepcopy
from eth2spec.test.context import spec_state_test, with_all_phases
from eth2spec.test.helpers.state import (
next_epoch,
next_slot
)
from eth2spec.test.helpers.block import apply_empty_block
from eth2spec.test.helpers.attestations import (
add_attestation_to_state,
fill_aggreg... | [
"eth2spec.test.helpers.state.next_epoch",
"copy.deepcopy",
"eth2spec.test.helpers.attestations.fill_aggregate_attestation",
"eth2spec.test.helpers.attestations.sign_attestation",
"eth2spec.test.helpers.state.next_slot",
"eth2spec.test.phase_0.epoch_processing.run_epoch_process_base.run_epoch_processing_wi... | [((965, 988), 'eth2spec.test.helpers.state.next_epoch', 'next_epoch', (['spec', 'state'], {}), '(spec, state)\n', (975, 988), False, 'from eth2spec.test.helpers.state import next_epoch, next_slot\n'), ((1008, 1055), 'eth2spec.test.helpers.attestations.get_valid_attestation', 'get_valid_attestation', (['spec', 'state'],... |
#!/usr/bin/python3
import openpyxl
from openpyxl.utils import get_column_letter, column_index_from_string
# Porque usar o util https://is.gd/YrDuST
wb = openpyxl.load_workbook('example.xlsx')
sheet = wb.get_sheet_by_name('Sheet1')
print('Obtendo a letra da coluna a partir de um inteiro')
print(get_column_l... | [
"openpyxl.utils.column_index_from_string",
"openpyxl.utils.get_column_letter",
"openpyxl.load_workbook"
] | [((161, 199), 'openpyxl.load_workbook', 'openpyxl.load_workbook', (['"""example.xlsx"""'], {}), "('example.xlsx')\n", (183, 199), False, 'import openpyxl\n'), ((308, 328), 'openpyxl.utils.get_column_letter', 'get_column_letter', (['(1)'], {}), '(1)\n', (325, 328), False, 'from openpyxl.utils import get_column_letter, c... |
import pathlib
import pandas as pd
from palmnet.visualization.utils import get_palminized_model_and_df, get_df
import matplotlib.pyplot as plt
import numpy as np
import logging
import plotly.graph_objects as go
import plotly.io as pio
from pprint import pprint as pprint
mpl_logger = logging.getLogger('matplotlib')
mpl... | [
"pandas.read_csv",
"plotly.graph_objects.Figure",
"numpy.isnan",
"pathlib.Path",
"numpy.isclose",
"pprint.pprint",
"pandas.concat",
"logging.getLogger"
] | [((285, 316), 'logging.getLogger', 'logging.getLogger', (['"""matplotlib"""'], {}), "('matplotlib')\n", (302, 316), False, 'import logging\n'), ((1573, 1612), 'pandas.read_csv', 'pd.read_csv', (['src_results_path'], {'header': '(0)'}), '(src_results_path, header=0)\n', (1584, 1612), True, 'import pandas as pd\n'), ((16... |