code stringlengths 22 1.05M | apis listlengths 1 3.31k | extract_api stringlengths 75 3.25M |
|---|---|---|
import json
import numpy as np
import itertools
import sys
path_name = sys.argv[1] + "/" + sys.argv[2]
pred_labels = np.load("./tmp/" + path_name + "/pred_labels_valid.npy")
num_classes = int(sys.argv[3])
num_layers = int(sys.argv[4])
total_layers = [x for x in range(num_layers)]
print("path_name: {}, num_classes: {... | [
"numpy.mean",
"numpy.where",
"numpy.argmax",
"itertools.combinations",
"numpy.sum",
"numpy.zeros",
"json.load",
"numpy.load",
"json.dump"
] | [((119, 175), 'numpy.load', 'np.load', (["('./tmp/' + path_name + '/pred_labels_valid.npy')"], {}), "('./tmp/' + path_name + '/pred_labels_valid.npy')\n", (126, 175), True, 'import numpy as np\n'), ((449, 497), 'numpy.zeros', 'np.zeros', (['[pred_label_idx.shape[0], num_classes]'], {}), '([pred_label_idx.shape[0], num_... |
#!/bin/env python
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# di... | [
"os.path.exists",
"argparse.ArgumentParser",
"os.path.join",
"uuid.uuid4",
"sys.stderr.write",
"os.unlink",
"os.path.basename",
"sys.exit",
"json.load",
"time.time",
"os.path.expanduser"
] | [((666, 689), 'os.path.expanduser', 'os.path.expanduser', (['"""~"""'], {}), "('~')\n", (684, 689), False, 'import os\n'), ((7271, 7380), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'formatter_class': 'argparse.RawDescriptionHelpFormatter', 'description': 'example_usage'}), '(formatter_class=argparse.\n... |
#!/usr/bin/env python3
"""
Make python installation relocatable which mainly involves fixing the shebang
in scripts installed by pip and making directories in .pth and .egg-link files
in the path relative.
Mostly stolen from virtualenv but slightly adapted to our needs
"""
import sys
import os
import itertools
impor... | [
"os.listdir",
"re.compile",
"os.access",
"os.path.join",
"os.path.isfile",
"os.path.dirname",
"os.path.isdir",
"os.path.basename",
"sys.exit",
"os.path.abspath",
"os.path.relpath"
] | [((560, 587), 're.compile', 're.compile', (['"""^#!.*python.*"""'], {}), "('^#!.*python.*')\n", (570, 587), False, 'import re\n'), ((722, 738), 'os.listdir', 'os.listdir', (['path'], {}), '(path)\n', (732, 738), False, 'import os\n'), ((4876, 4899), 'os.path.dirname', 'os.path.dirname', (['source'], {}), '(source)\n', ... |
from architecture.trainer import Trainer
LEARNING_RATES = [
0.01,
0.001,
0.0001
]
for current in LEARNING_RATES:
trainer = Trainer(learning_rate = current)
trainer.train(num_episodes = 500) | [
"architecture.trainer.Trainer"
] | [((133, 163), 'architecture.trainer.Trainer', 'Trainer', ([], {'learning_rate': 'current'}), '(learning_rate=current)\n', (140, 163), False, 'from architecture.trainer import Trainer\n')] |
import html
import rich.table
import rich.text
import rich.console
from preql.context import context
from .exceptions import Signal
from .pql_types import T, ITEM_NAME
from . import pql_objects as objects
from .pql_ast import pyvalue
from .types_impl import dp_type, pql_repr
from .interp_common import call_builtin_f... | [
"html.escape"
] | [((1109, 1125), 'html.escape', 'html.escape', (['res'], {}), '(res)\n', (1120, 1125), False, 'import html\n'), ((5717, 5733), 'html.escape', 'html.escape', (['res'], {}), '(res)\n', (5728, 5733), False, 'import html\n'), ((5871, 5887), 'html.escape', 'html.escape', (['res'], {}), '(res)\n', (5882, 5887), False, 'import... |
from urllib.parse import urlparse, urlunparse
class Link:
""" Dynamic link (`url` (parse/unpars)ed when set/get) """
def __init__(self, url: str, content: str = None):
self.url = url
self.content = content
@property
def url(self):
return urlunparse(
(
... | [
"urllib.parse.urlunparse",
"urllib.parse.urlparse"
] | [((282, 375), 'urllib.parse.urlunparse', 'urlunparse', (['(self.scheme, self.netloc, self.path, self.params, self.query, self.fragment)'], {}), '((self.scheme, self.netloc, self.path, self.params, self.query,\n self.fragment))\n', (292, 375), False, 'from urllib.parse import urlparse, urlunparse\n'), ((591, 604), 'u... |
from django import forms
from models import Article
class NewsArticleForm(forms.ModelForm):
class Meta(object):
model = Article
widgets = {
'body': forms.Textarea(attrs={'class': 'text-edit'}),
}
| [
"django.forms.Textarea"
] | [((181, 225), 'django.forms.Textarea', 'forms.Textarea', ([], {'attrs': "{'class': 'text-edit'}"}), "(attrs={'class': 'text-edit'})\n", (195, 225), False, 'from django import forms\n')] |
from django.urls import path
from . import views
from .views import (
TodoListView,
TodoDetailView,
TodoCreateView,
TodoUpdateView,
TodoDeleteView
)
urlpatterns = [
path('', TodoListView.as_view(), name='todos-home'),
path('viewtodo/<int:pk>/detail', TodoDetailView.as_view(), name='todos-... | [
"django.urls.path"
] | [((573, 626), 'django.urls.path', 'path', (['"""contact/"""', 'views.contact'], {'name': '"""todos-contact"""'}), "('contact/', views.contact, name='todos-contact')\n", (577, 626), False, 'from django.urls import path\n')] |
from typing import Optional
import numpy as np
import skimage.draw as skdraw
from gdsfactory.component import Component
from gdsfactory.types import Floats, Layers
def to_np(
component: Component,
nm_per_pixel: int = 20,
layers: Layers = ((1, 0),),
values: Optional[Floats] = None,
pad_width: int... | [
"numpy.ceil",
"matplotlib.pyplot.show",
"gdsfactory.c.bend_circular",
"matplotlib.pyplot.colorbar",
"numpy.zeros",
"skimage.draw.polygon",
"numpy.pad",
"gdsfactory.c.straight"
] | [((941, 969), 'numpy.zeros', 'np.zeros', (['shape'], {'dtype': 'float'}), '(shape, dtype=float)\n', (949, 969), True, 'import numpy as np\n'), ((1526, 1558), 'numpy.pad', 'np.pad', (['img'], {'pad_width': 'pad_width'}), '(img, pad_width=pad_width)\n', (1532, 1558), True, 'import numpy as np\n'), ((1690, 1705), 'gdsfact... |
from pytest import raises
from jqfilters.filters import Filter
from jqfilters.operations import identity
class TestFilter():
def test__init__ok_notransform(self):
op1 = '.a'
operator = 'ge'
op2 = 4
f = Filter(op1=op1, operator=operator, op2=op2)
assert isinstance(f, Filter... | [
"jqfilters.filters.Filter",
"jqfilters.filters.Filter.fromConfig",
"pytest.raises"
] | [((241, 284), 'jqfilters.filters.Filter', 'Filter', ([], {'op1': 'op1', 'operator': 'operator', 'op2': 'op2'}), '(op1=op1, operator=operator, op2=op2)\n', (247, 284), False, 'from jqfilters.filters import Filter\n'), ((503, 568), 'jqfilters.filters.Filter', 'Filter', ([], {'op1': 'op1', 'operator': 'operator', 'op2': '... |
import argparse
import os.path as osp
import torch.optim as optim
from eval import evaluate
from utils.tools import *
from module.Encoder import Deeplabv2
from module.Discriminator import FCDiscriminator
from data.loveda import LoveDALoader
from utils.tools import COLOR_MAP
from ever.core.iterator import Iterator
from ... | [
"argparse.ArgumentParser",
"os.path.join",
"eval.evaluate",
"utils.tools.COLOR_MAP.values",
"module.Discriminator.FCDiscriminator",
"ever.core.iterator.Iterator",
"data.loveda.LoveDALoader"
] | [((457, 513), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Run ISAT methods."""'}), "(description='Run ISAT methods.')\n", (480, 513), False, 'import argparse\n'), ((833, 875), 'os.path.join', 'osp.join', (['cfg.SNAPSHOT_DIR', '"""pseudo_label"""'], {}), "(cfg.SNAPSHOT_DIR, 'pseudo_lab... |
# -*- coding: utf-8 -*-
# Copyright 2017-2018 ICON Foundation
#
# 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 ... | [
"os.path.exists",
"tbears.util.arg_parser.uri_parser",
"iconsdk.builder.transaction_builder.TransactionBuilder",
"tbears.command.command.Command",
"tbears.util.transaction_logger.send_transaction_with_logger",
"os.path.join",
"iconsdk.utils.convert_type.convert_hex_str_to_int",
"iconsdk.signed_transac... | [((1494, 1503), 'tbears.command.command.Command', 'Command', ([], {}), '()\n', (1501, 1503), False, 'from tbears.command.command import Command\n'), ((2617, 2685), 'os.path.join', 'os.path.join', (['TEST_UTIL_DIRECTORY', 'f"""test_tbears_server_config.json"""'], {}), "(TEST_UTIL_DIRECTORY, f'test_tbears_server_config.j... |
import setuptools
with open("README.md", "r") as fh:
long_description = fh.read()
with open("requirements.txt", "r") as fh:
INSTALL_REQUIRES = [l.split('#')[0].strip() for l in fh if not l.strip().startswith('#')]
setuptools.setup(
name="all_twitter_scraper",
version="0.0.4",
author="<NAME>",
... | [
"setuptools.find_packages"
] | [((663, 689), 'setuptools.find_packages', 'setuptools.find_packages', ([], {}), '()\n', (687, 689), False, 'import setuptools\n')] |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import argparse
import random
import time
import os
import sys
import curses
from csv import reader
# from threading import Thread
# from functools import partial
import subprocess
import datetime
def logfile(msg):
if False:
# if True:
with open("log.log"... | [
"curses.color_pair",
"os.path.exists",
"curses.wrapper",
"argparse.ArgumentParser",
"curses.init_pair",
"subprocess.Popen",
"curses.curs_set",
"curses.use_default_colors",
"curses.napms",
"csv.reader",
"sys.exit",
"time.time"
] | [((789, 811), 'curses.curs_set', 'curses.curs_set', (['(False)'], {}), '(False)\n', (804, 811), False, 'import curses\n'), ((816, 843), 'curses.use_default_colors', 'curses.use_default_colors', ([], {}), '()\n', (841, 843), False, 'import curses\n'), ((2023, 2034), 'sys.exit', 'sys.exit', (['(0)'], {}), '(0)\n', (2031,... |
import unittest
from sqlalchemy.orm import sessionmaker
#from nesta.core.orms.uk_geography_lookup_orm import UkGeographyLookup
from nesta.core.orms.uk_geography_lookup_orm import Base
from nesta.core.orms.orm_utils import get_mysql_engine
class TestUkGeographyLookup(unittest.TestCase):
'''Check that the Wiktionar... | [
"sqlalchemy.orm.sessionmaker",
"nesta.core.orms.orm_utils.get_mysql_engine",
"nesta.core.orms.uk_geography_lookup_orm.Base.metadata.drop_all",
"nesta.core.orms.uk_geography_lookup_orm.Base.metadata.create_all",
"unittest.main"
] | [((365, 407), 'nesta.core.orms.orm_utils.get_mysql_engine', 'get_mysql_engine', (['"""MYSQLDBCONF"""', '"""mysqldb"""'], {}), "('MYSQLDBCONF', 'mysqldb')\n", (381, 407), False, 'from nesta.core.orms.orm_utils import get_mysql_engine\n'), ((422, 442), 'sqlalchemy.orm.sessionmaker', 'sessionmaker', (['engine'], {}), '(en... |
#!/usr/bin/env python3
# Copyright 2019 <NAME>
# 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... | [
"mnets.classifier_interface.Classifier.softmax_and_cross_entropy",
"mnist.train_args.parse_cmd_arguments",
"torch.max",
"mnets.classifier_interface.Classifier.knowledge_distillation_loss",
"copy.deepcopy",
"torch.nn.functional.softmax",
"mnist.train_utils.generate_classifier",
"mnist.train_args_defaul... | [((1176, 1197), 'matplotlib.use', 'matplotlib.use', (['"""Agg"""'], {}), "('Agg')\n", (1190, 1197), False, 'import matplotlib\n'), ((2663, 2704), 'utils.misc.list_to_str', 'misc.list_to_str', (['config.overall_acc_list'], {}), '(config.overall_acc_list)\n', (2679, 2704), False, 'from utils import misc\n'), ((2733, 2775... |
# Generated by Django 2.2.5 on 2020-03-02 17:16
from django.db import migrations, models
import employee_management.models
class Migration(migrations.Migration):
dependencies = [
('employee_management', '0013_education_employee'),
]
operations = [
migrations.CreateModel(
nam... | [
"django.db.models.AutoField",
"django.db.models.FileField",
"django.db.models.CharField"
] | [((769, 842), 'django.db.models.FileField', 'models.FileField', ([], {'upload_to': 'employee_management.models.document_file_path'}), '(upload_to=employee_management.models.document_file_path)\n', (785, 842), False, 'from django.db import migrations, models\n'), ((379, 472), 'django.db.models.AutoField', 'models.AutoFi... |
# Generated by Django 3.2.3 on 2021-06-08 16:48
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='Company',
... | [
"django.db.models.EmailField",
"django.db.models.IntegerField",
"django.db.models.ForeignKey",
"django.db.models.DateTimeField",
"django.db.models.BigAutoField",
"django.db.models.URLField",
"django.db.models.CharField"
] | [((353, 449), 'django.db.models.BigAutoField', 'models.BigAutoField', ([], {'auto_created': '(True)', 'primary_key': '(True)', 'serialize': '(False)', 'verbose_name': '"""ID"""'}), "(auto_created=True, primary_key=True, serialize=False,\n verbose_name='ID')\n", (372, 449), False, 'from django.db import migrations, m... |
# Copyright (c) BrownBear, 2021-Present. All rights reserved
# Copyright (c) Xerox Corporation, Codendi Team, 2001-2009. All rights reserved
#
# This file is a part of Tuleap.
#
# Tuleap is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the ... | [
"os.path.exists",
"os.stat"
] | [((1250, 1270), 'os.path.exists', 'os.path.exists', (['path'], {}), '(path)\n', (1264, 1270), False, 'import os\n'), ((1357, 1377), 'os.path.exists', 'os.path.exists', (['path'], {}), '(path)\n', (1371, 1377), False, 'import os\n'), ((1411, 1424), 'os.stat', 'os.stat', (['path'], {}), '(path)\n', (1418, 1424), False, '... |
################################################################
# The contents of this file are subject to the BSD 3Clause (New) License
# you may not use this file except in
# compliance with the License. You may obtain a copy of the License at
# http://directory.fsf.org/wiki/License:BSD_3Clause
# Software distribut... | [
"sklearn.model_selection.LeaveOneOut",
"numpy.sqrt",
"numpy.random.rand",
"re.compile",
"numpy.where",
"numpy.log",
"math.float",
"sklearn.neighbors.KernelDensity",
"math.floor_",
"numpy.zeros",
"numpy.linspace",
"numpy.isnan",
"numpy.random.randn",
"re.sub",
"numpy.zeros_like"
] | [((4176, 4195), 'numpy.isnan', 'np.isnan', (['bandwidth'], {}), '(bandwidth)\n', (4184, 4195), True, 'import numpy as np\n'), ((5252, 5270), 'numpy.zeros_like', 'np.zeros_like', (['x_d'], {}), '(x_d)\n', (5265, 5270), True, 'import numpy as np\n'), ((18241, 18259), 're.compile', 're.compile', (['"""\\\\s+"""'], {}), "(... |
"""Functions to perform CRUD operations on the database."""
from typing import List
from sqlalchemy import desc, func
from sqlalchemy.orm import Session
from app import models
def get_user_by_username(db: Session, username: str) -> models.User:
"""Return user with matching username."""
return db.query(models... | [
"sqlalchemy.func.count",
"sqlalchemy.desc"
] | [((781, 799), 'sqlalchemy.desc', 'desc', (['"""num_visits"""'], {}), "('num_visits')\n", (785, 799), False, 'from sqlalchemy import desc, func\n'), ((552, 587), 'sqlalchemy.func.count', 'func.count', (['models.Bird.common_name'], {}), '(models.Bird.common_name)\n', (562, 587), False, 'from sqlalchemy import desc, func\... |
# Copyright (c) 2021 CNES/JPL
#
# All rights reserved. Use of this source code is governed by a
# BSD-style license that can be found in the LICENSE file.
"""
Constants that are defined for SWOT simulator
---------------------------------------------
"""
import pathlib
#
from . import version
#: Module Version
__vers... | [
"pathlib.Path"
] | [((1032, 1054), 'pathlib.Path', 'pathlib.Path', (['__file__'], {}), '(__file__)\n', (1044, 1054), False, 'import pathlib\n')] |
from pylexers.BaseLexer import Lexer
from pylexers.NFALexer.NFA import NFA, _combine_nfas
from pylexers.NFALexer.nfa_from_re import _regular_expression_to_nfa
class NFALexer(Lexer):
def __init__(self, regular_expressions: list, tokenize_functions: list):
super().__init__(regular_expressions, tokenize_func... | [
"pylexers.NFALexer.nfa_from_re._regular_expression_to_nfa",
"pylexers.NFALexer.NFA._combine_nfas"
] | [((661, 684), 'pylexers.NFALexer.NFA._combine_nfas', '_combine_nfas', (['nfa_list'], {}), '(nfa_list)\n', (674, 684), False, 'from pylexers.NFALexer.NFA import NFA, _combine_nfas\n'), ((347, 377), 'pylexers.NFALexer.nfa_from_re._regular_expression_to_nfa', '_regular_expression_to_nfa', (['re'], {}), '(re)\n', (373, 377... |
import mock
from nose.tools import assert_equal, assert_in, raises, assert_is, assert_is_instance, assert_false, assert_true
from .. import metrics as mm, exceptions, histogram, simple_metrics as simple, meter
class TestMetricsModule(object):
def setUp(self):
self.original_registy = mm.REGISTRY.copy()
... | [
"nose.tools.assert_is_instance",
"mock.patch",
"mock.Mock",
"nose.tools.raises",
"nose.tools.assert_in",
"mock.call",
"nose.tools.assert_equal"
] | [((1040, 1079), 'nose.tools.raises', 'raises', (['exceptions.DuplicateMetricError'], {}), '(exceptions.DuplicateMetricError)\n', (1046, 1079), False, 'from nose.tools import assert_equal, assert_in, raises, assert_is, assert_is_instance, assert_false, assert_true\n'), ((1225, 1262), 'nose.tools.raises', 'raises', (['ex... |
from setuptools import setup
with open("README.md", "r") as f:
long_description = f.read()
setup(
name="javaccflab",
packages=["javaccflab"],
entry_points={
"console_scripts": ['javaccflab = javaccflab.java_ccf:main']
},
version='0.1.12',
description="JavaCCF is utility to fix styl... | [
"setuptools.setup"
] | [((97, 513), 'setuptools.setup', 'setup', ([], {'name': '"""javaccflab"""', 'packages': "['javaccflab']", 'entry_points': "{'console_scripts': ['javaccflab = javaccflab.java_ccf:main']}", 'version': '"""0.1.12"""', 'description': '"""JavaCCF is utility to fix style in Java files"""', 'long_description': 'long_descripti... |
from django.contrib.auth.mixins import LoginRequiredMixin
from django.views.generic import TemplateView
from project.models import Project, ProjectUserMembership
class DashboardView(LoginRequiredMixin, TemplateView):
template_name = 'dashboard.html'
def get_context_data(self, **kwargs):
context = sup... | [
"project.models.ProjectUserMembership.objects.awaiting_authorisation",
"project.models.ProjectUserMembership.objects.filter",
"project.models.Project.objects.awaiting_approval",
"project.models.Project.objects.filter"
] | [((940, 1033), 'project.models.ProjectUserMembership.objects.filter', 'ProjectUserMembership.objects.filter', ([], {'user': 'user', 'status': 'ProjectUserMembership.AUTHORISED'}), '(user=user, status=\n ProjectUserMembership.AUTHORISED)\n', (976, 1033), False, 'from project.models import Project, ProjectUserMembersh... |
import json
import os
from nose.plugins.attrib import attr
from test.integration.base import DBTIntegrationTest
class TestDocsGenerate(DBTIntegrationTest):
def setUp(self):
super(TestDocsGenerate, self).setUp()
self.run_sql_file("test/integration/029_docs_generate_tests/seed.sql")
@property... | [
"json.load",
"os.path.exists",
"nose.plugins.attrib.attr"
] | [((686, 707), 'nose.plugins.attrib.attr', 'attr', ([], {'type': '"""postgres"""'}), "(type='postgres')\n", (690, 707), False, 'from nose.plugins.attrib import attr\n'), ((811, 850), 'os.path.exists', 'os.path.exists', (['"""./target/catalog.json"""'], {}), "('./target/catalog.json')\n", (825, 850), False, 'import os\n'... |
import pypsa, os
import numpy as np
import cartopy.crs as ccrs
import matplotlib.pyplot as plt
network = pypsa.Network()
folder_name = "ac-dc-data"
network.import_from_csv_folder(folder_name)
network.lopf(network.snapshots)
fig, ax = plt.subplots(subplot_kw={'projection': ccrs.EqualEarth()},
... | [
"os.path.join",
"cartopy.crs.EqualEarth",
"numpy.testing.assert_allclose",
"pypsa.Network"
] | [((106, 121), 'pypsa.Network', 'pypsa.Network', ([], {}), '()\n', (119, 121), False, 'import pypsa, os\n'), ((1949, 1990), 'os.path.join', 'os.path.join', (['folder_name', '"""results-lopf"""'], {}), "(folder_name, 'results-lopf')\n", (1961, 1990), False, 'import pypsa, os\n'), ((1769, 1836), 'numpy.testing.assert_allc... |
from itertools import combinations
n=int(input())
letters=[x for x in input().split()]
k=int(input())
res=list(combinations(letters,k))
count=0
for i in res:
if 'a' in i:
count+=1
print(count/len(res)) | [
"itertools.combinations"
] | [((115, 139), 'itertools.combinations', 'combinations', (['letters', 'k'], {}), '(letters, k)\n', (127, 139), False, 'from itertools import combinations\n')] |
import magma as m
from magma.testing import check_files_equal
import os
def test_inline_2d_array_interface():
class Main(m.Generator):
@staticmethod
def generate(width, depth):
class MonitorWrapper(m.Circuit):
io = m.IO(arr=m.In(m.Array[depth, m.Bits[width]]))
... | [
"magma.inline_verilog",
"magma.In",
"os.path.dirname",
"magma.testing.check_files_equal",
"os.system"
] | [((620, 736), 'magma.testing.check_files_equal', 'check_files_equal', (['__file__', 'f"""build/test_inline_2d_array_interface.v"""', 'f"""gold/test_inline_2d_array_interface.v"""'], {}), "(__file__, f'build/test_inline_2d_array_interface.v',\n f'gold/test_inline_2d_array_interface.v')\n", (637, 736), False, 'from ma... |
import numpy as np
import torch
"""
this file contains various functions for point cloud transformation,
some of which are not used in the clean version of code,
but feel free to use them if you have different forms of point clouds.
"""
def swap_axis(input_np, swap_mode='n210'):
"""
swap axis for point clouds... | [
"numpy.mean",
"numpy.abs",
"numpy.random.shuffle",
"torch.from_numpy",
"numpy.max",
"numpy.stack",
"torch.norm",
"numpy.sum",
"numpy.random.seed",
"pdb.set_trace",
"numpy.min",
"torch.where"
] | [((4191, 4208), 'numpy.stack', 'np.stack', (['pcd_new'], {}), '(pcd_new)\n', (4199, 4208), True, 'import numpy as np\n'), ((4394, 4417), 'numpy.mean', 'np.mean', (['pc_CRN'], {'axis': '(0)'}), '(pc_CRN, axis=0)\n', (4401, 4417), True, 'import numpy as np\n'), ((4639, 4665), 'torch.norm', 'torch.norm', (['partial'], {'d... |
from django.db import models
from django.utils.translation import ugettext, ugettext_lazy as _
class Country( models.Model ):
"""
International Organization for Standardization (ISO) 3166-1 Country list
Instance Variables:
iso -- ISO 3166-1 alpha-2
name -- Official country names (in all caps)... | [
"django.utils.translation.ugettext",
"django.utils.translation.ugettext_lazy",
"django.db.models.PositiveIntegerField"
] | [((1200, 1238), 'django.db.models.PositiveIntegerField', 'models.PositiveIntegerField', ([], {'default': '(0)'}), '(default=0)\n', (1227, 1238), False, 'from django.db import models\n'), ((968, 984), 'django.utils.translation.ugettext_lazy', '_', (['"""ISO alpha-2"""'], {}), "('ISO alpha-2')\n", (969, 984), True, 'from... |
import numpy as np
from web.evaluate import calculate_purity, evaluate_categorization
from web.embedding import Embedding
from web.datasets.utils import _fetch_file
from web.datasets.categorization import fetch_ESSLI_2c
def test_purity():
y_true = np.array([1,1,2,2,3])
y_pred = np.array([2,2,2,2,1])
assert... | [
"web.datasets.categorization.fetch_ESSLI_2c",
"web.datasets.utils._fetch_file",
"web.evaluate.calculate_purity",
"numpy.array",
"web.evaluate.evaluate_categorization",
"web.embedding.Embedding.from_word2vec"
] | [((253, 278), 'numpy.array', 'np.array', (['[1, 1, 2, 2, 3]'], {}), '([1, 1, 2, 2, 3])\n', (261, 278), True, 'import numpy as np\n'), ((288, 313), 'numpy.array', 'np.array', (['[2, 2, 2, 2, 1]'], {}), '([2, 2, 2, 2, 1])\n', (296, 313), True, 'import numpy as np\n'), ((412, 428), 'web.datasets.categorization.fetch_ESSLI... |
import argparse
import numpy as np
from squeezenet import SqueezeNet
import os
from keras.preprocessing import image
from keras.applications.imagenet_utils import preprocess_input
SIZE = 227
def main():
parser = argparse.ArgumentParser()
parser.add_argument('--checkpoint-path', required=True)
parser.add_a... | [
"keras.preprocessing.image.img_to_array",
"argparse.ArgumentParser",
"numpy.argmax",
"numpy.array",
"keras.applications.imagenet_utils.preprocess_input",
"squeezenet.SqueezeNet",
"keras.preprocessing.image.load_img"
] | [((218, 243), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (241, 243), False, 'import argparse\n'), ((475, 525), 'squeezenet.SqueezeNet', 'SqueezeNet', ([], {'weights': 'None', 'classes': 'args.num_classes'}), '(weights=None, classes=args.num_classes)\n', (485, 525), False, 'from squeezenet i... |
import re
"""
Summary: Markdown to Html Converter
Author: rozeroze
"""
"""
TODO: filepathをもらって、読込を行う関数の定義
TODO: 改行毎のリストではなく、空行毎の段落で操作
"""
# _sample (markdown) {{{
_sample = '''
### title-test
> this is description
##### list 1
* test1
* test2
* test2-1
* test2-2
* test3
##### list 2
- test
- test
- te... | [
"re.match"
] | [((621, 642), 're.match', 're.match', (['"""^#"""', '_line'], {}), "('^#', _line)\n", (629, 642), False, 'import re\n'), ((828, 853), 're.match', 're.match', (['"""^[-+*]"""', '_line'], {}), "('^[-+*]', _line)\n", (836, 853), False, 'import re\n')] |
import numpy as np
import pandas as pd
from rbergomi.rbergomi_utils import *
class rBergomi(object):
"""
Class for generating paths of the rBergomi model.
Integral equations for reference:
Y(t) := sqrt(2a + 1) int 0,t (t - u)^a dW(u)
V(t) := xi exp(eta Y - 0.5 eta^2 t^(2a + 1))
S(t) := S0 int ... | [
"numpy.random.normal",
"numpy.mean",
"numpy.convolve",
"numpy.sqrt",
"numpy.squeeze",
"numpy.exp",
"numpy.linalg.cholesky",
"numpy.zeros",
"numpy.linspace",
"numpy.matmul",
"numpy.random.seed",
"pandas.DataFrame",
"numpy.cumsum",
"numpy.maximum",
"numpy.zeros_like",
"numpy.arange",
"... | [((1276, 1296), 'numpy.random.seed', 'np.random.seed', (['seed'], {}), '(seed)\n', (1290, 1296), True, 'import numpy as np\n'), ((1322, 1360), 'numpy.random.normal', 'np.random.normal', ([], {'size': '(self.N, 4 * s)'}), '(size=(self.N, 4 * s))\n', (1338, 1360), True, 'import numpy as np\n'), ((1602, 1629), 'numpy.zero... |
# Generated by Django 2.2.9 on 2020-01-24 20:45
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('core', '0002_board_user'),
]
operations = [
migrations.AlterField(
model_name='card',
name='name',
field... | [
"django.db.models.TextField"
] | [((321, 339), 'django.db.models.TextField', 'models.TextField', ([], {}), '()\n', (337, 339), False, 'from django.db import migrations, models\n')] |
"""
Provided with a path to the file with logs from a reports generator run,
this script looks for all debug file locations, downloads them from S3 bucket
and tries to match them to the well-known errors.
If cannot do so, dumps all the necessary troubleshooting data into OUTPUT_DIR
in a convenient format.
"""
import io... | [
"boto3.client",
"pathlib.Path",
"re.compile",
"io.BytesIO",
"shutil.rmtree"
] | [((475, 526), 're.compile', 're.compile', (['"""([\\\\w/\\\\-.]+(?:\\\\.debug\\\\.json|.tsv))"""'], {}), "('([\\\\w/\\\\-.]+(?:\\\\.debug\\\\.json|.tsv))')\n", (485, 526), False, 'import re\n'), ((543, 588), 're.compile', 're.compile', (['"""set\\\\s+yrange\\\\s+\\\\[(.+):\\\\1\\\\]"""'], {}), "('set\\\\s+yrange\\\\s+\... |
"""Script for checking that Java and Kotlin snippets are in line.
Example:
$ python scripts/checksnippets.py
Checking snippets in folder: storage/app/src/
ERROR: Missing kotlin file for java file FirebaseUIActivity.java
ERROR: The following snippets are missing from StorageActivity.kt: set(['storage_custom_app'])
ERRO... | [
"re.compile",
"os.path.join",
"os.path.basename",
"fnmatch.filter",
"os.walk"
] | [((526, 564), 're.compile', 're.compile', (['"""\\\\[START ([\\\\w_\\\\-]+)\\\\]"""'], {}), "('\\\\[START ([\\\\w_\\\\-]+)\\\\]')\n", (536, 564), False, 'import re\n'), ((583, 619), 're.compile', 're.compile', (['"""\\\\[END ([\\\\w_\\\\-]+)\\\\]"""'], {}), "('\\\\[END ([\\\\w_\\\\-]+)\\\\]')\n", (593, 619), False, 'im... |
#!/usr/bin/env python3
import re
import urllib3
from app.lib.utils.request import request
from app.lib.utils.common import get_capta, get_useragent
class Tongda_Oa_Rce_BaseVerify:
def __init__(self, url):
self.info = {
'name': '通达OA远程命令执行漏洞',
'description': '通达OA远程命令执行漏洞可执行任意命令,影响范... | [
"re.findall",
"app.lib.utils.common.get_capta",
"app.lib.utils.request.request.post",
"app.lib.utils.common.get_useragent"
] | [((824, 835), 'app.lib.utils.common.get_capta', 'get_capta', ([], {}), '()\n', (833, 835), False, 'from app.lib.utils.common import get_capta, get_useragent\n'), ((516, 531), 'app.lib.utils.common.get_useragent', 'get_useragent', ([], {}), '()\n', (529, 531), False, 'from app.lib.utils.common import get_capta, get_user... |
import requests
from django.conf import settings
from constance import config
class Canvas:
base_url = "https://canvas.instructure.com/api/v1/"
graphql_url = "https://canvas.instructure.com/api/graphql/"
def __init__(self):
self.api_token = config.CANVAS_API_TOKEN
def _get(self, url):
... | [
"requests.post",
"requests.get"
] | [((326, 418), 'requests.get', 'requests.get', (['(self.base_url + url)'], {'headers': "{'Authorization': 'Bearer ' + self.api_token}"}), "(self.base_url + url, headers={'Authorization': 'Bearer ' +\n self.api_token})\n", (338, 418), False, 'import requests\n'), ((530, 633), 'requests.post', 'requests.post', (['self.... |
#
# Copyright(c) 2019-2022 Intel Corporation
# SPDX-License-Identifier: BSD-3-Clause
#
import os
import sys
import pytest
import gc
sys.path.append(os.path.join(os.path.dirname(__file__), os.path.pardir))
from pyocf.types.logger import LogLevel, DefaultLogger, BufferLogger
from pyocf.types.volume import RamVolume, Er... | [
"pyocf.types.logger.DefaultLogger",
"pyocf.types.ctx.OcfCtx.with_defaults",
"pyocf.types.logger.BufferLogger",
"os.path.dirname",
"pyocf.helpers.get_composite_volume_type_id",
"gc.collect",
"pytest.fixture"
] | [((825, 841), 'pytest.fixture', 'pytest.fixture', ([], {}), '()\n', (839, 841), False, 'import pytest\n'), ((1132, 1148), 'pytest.fixture', 'pytest.fixture', ([], {}), '()\n', (1146, 1148), False, 'import pytest\n'), ((1475, 1491), 'pytest.fixture', 'pytest.fixture', ([], {}), '()\n', (1489, 1491), False, 'import pytes... |
import unittest
import numpy as np
import numpy.testing as npt
from flatlander.envs.observations.positional_tree_obs import PositionalTreeObservation
from flatlander.envs.observations.tree_obs import TreeObservation
from flatlander.test.observations.dummy_tree_builder import DummyBuilder
class PositionalTreeObserva... | [
"flatlander.test.observations.dummy_tree_builder.DummyBuilder",
"flatlander.envs.observations.tree_obs.TreeObservation"
] | [((494, 558), 'flatlander.envs.observations.tree_obs.TreeObservation', 'TreeObservation', (["{'max_depth': 2, 'shortest_path_max_depth': 30}"], {}), "({'max_depth': 2, 'shortest_path_max_depth': 30})\n", (509, 558), False, 'from flatlander.envs.observations.tree_obs import TreeObservation\n'), ((596, 636), 'flatlander.... |
#=======================================================================
# pipelines.py
#=======================================================================
# Collection of pipelines for cycle-level modeling.
from pymtl import *
from collections import deque
#------------------------------------------------... | [
"collections.deque"
] | [((554, 591), 'collections.deque', 'deque', (['([None] * stages)'], {'maxlen': 'stages'}), '([None] * stages, maxlen=stages)\n', (559, 591), False, 'from collections import deque\n')] |
"""Settings configuration - Configuration for environment variables can go in here."""
import os
SECRET_KEY = 'hello world'
ENV = os.getenv('FLASK_ENV', default='production')
DEBUG = ENV == 'development'
SQLALCHEMY_TRACK_MODIFICATIONS = False
SQLALCHEMY_DATABASE_URI = 'sqlite:///' + os.path.join(os.path.dirname(os.pa... | [
"os.path.realpath",
"os.getenv"
] | [((132, 176), 'os.getenv', 'os.getenv', (['"""FLASK_ENV"""'], {'default': '"""production"""'}), "('FLASK_ENV', default='production')\n", (141, 176), False, 'import os\n'), ((315, 341), 'os.path.realpath', 'os.path.realpath', (['__file__'], {}), '(__file__)\n', (331, 341), False, 'import os\n')] |
from typing import Tuple, List
import pytest
from pytree import RBTree
def is_redblack(node) -> Tuple[bool, int]:
# keep going down the chain of nodes
# until the leftmost/rightmost node has been reached
# then, return True, as leaf nodes has no child nodes
# and are inherently colour-balanced
# a... | [
"pytree.RBTree"
] | [((1454, 1462), 'pytree.RBTree', 'RBTree', ([], {}), '()\n', (1460, 1462), False, 'from pytree import RBTree\n')] |
'''
Created on 2014-8-28
@author: xiajie
'''
import numpy as np
def centering(X):
N = len(X)
D = len(X[0])
centered = np.zeros((N, D))
mean = np.mean(X, axis=0)
for i in range(N):
centered[i] = X[i] - mean
return centered
def eigen_decomposition(X):
cov = X.dot(np.transpose(X))
... | [
"numpy.mean",
"numpy.zeros",
"numpy.transpose",
"numpy.linalg.eig"
] | [((132, 148), 'numpy.zeros', 'np.zeros', (['(N, D)'], {}), '((N, D))\n', (140, 148), True, 'import numpy as np\n'), ((160, 178), 'numpy.mean', 'np.mean', (['X'], {'axis': '(0)'}), '(X, axis=0)\n', (167, 178), True, 'import numpy as np\n'), ((329, 347), 'numpy.linalg.eig', 'np.linalg.eig', (['cov'], {}), '(cov)\n', (342... |
import gzip
import struct
from pathlib import Path
from typing import Tuple
from deriv8.matrix2d import Tensor2D, divide
MAX_ITEMS = 60000
def load() -> Tuple[Tensor2D, Tensor2D, Tensor2D, Tensor2D]:
path = Path(__file__).parent.parent.parent / 'datasets' / 'mnist'
train_images = _load_images(path / 'train... | [
"deriv8.matrix2d.divide",
"pathlib.Path",
"gzip.open"
] | [((671, 691), 'deriv8.matrix2d.divide', 'divide', (['X', '[[255.0]]'], {}), '(X, [[255.0]])\n', (677, 691), False, 'from deriv8.matrix2d import Tensor2D, divide\n'), ((744, 765), 'gzip.open', 'gzip.open', (['path', '"""rb"""'], {}), "(path, 'rb')\n", (753, 765), False, 'import gzip\n'), ((1635, 1656), 'gzip.open', 'gzi... |
from django.contrib.auth.decorators import permission_required
from django.urls import path, include
from . import views
app_name = 'staffing'
department = [
path('', views.DepartmentList.as_view(), name='list'),
path('create/', permission_required('is_superuser')(views.DepartmentCreate.as_view()), name='cr... | [
"django.contrib.auth.decorators.permission_required",
"django.urls.include"
] | [((1634, 1665), 'django.urls.include', 'include', (["(staffing, 'staffing')"], {}), "((staffing, 'staffing'))\n", (1641, 1665), False, 'from django.urls import path, include\n'), ((1692, 1727), 'django.urls.include', 'include', (["(department, 'department')"], {}), "((department, 'department'))\n", (1699, 1727), False,... |
import time
#from sqs_class import aws_sqs
import logging
#aws_sqs = aws_sqs()
logging.basicConfig(
format = '%s(asctime)s %(levelname)-8s %(message)s', level=logging.INFO, datefmt='%Y-%m-%d %H:%M:%S', filename='pythonLog')
while (1):
'''
message = aws_sqs.receive_message( )
if message == None:
logging.info... | [
"logging.basicConfig",
"time.sleep"
] | [((82, 227), 'logging.basicConfig', 'logging.basicConfig', ([], {'format': '"""%s(asctime)s %(levelname)-8s %(message)s"""', 'level': 'logging.INFO', 'datefmt': '"""%Y-%m-%d %H:%M:%S"""', 'filename': '"""pythonLog"""'}), "(format='%s(asctime)s %(levelname)-8s %(message)s',\n level=logging.INFO, datefmt='%Y-%m-%d %H:... |
import logging
from boto3.dynamodb.conditions import Key
from botocore.exceptions import ClientError
from api.common import errors, validation
from api.data_access import dynamo_db as db, question_dao
from api.model.model import QuizModel
from api.utils.id_utils import generate_id
table = db.dynamo_db.Table('qm_quiz... | [
"api.common.validation.validate_item_exists",
"logging.debug",
"api.model.model.QuizModel.from_dynamo",
"api.common.errors.ApiError",
"api.utils.id_utils.generate_id",
"api.data_access.question_dao.delete",
"api.data_access.question_dao.get_by_quiz_id_quietly",
"boto3.dynamodb.conditions.Key",
"api.... | [((293, 322), 'api.data_access.dynamo_db.dynamo_db.Table', 'db.dynamo_db.Table', (['"""qm_quiz"""'], {}), "('qm_quiz')\n", (311, 322), True, 'from api.data_access import dynamo_db as db, question_dao\n'), ((522, 571), 'api.common.validation.validate_items_exist_quietly', 'validation.validate_items_exist_quietly', (['re... |
import streamlit as st
from pydantic import BaseModel
import streamlit_pydantic as sp
class ExampleModel(BaseModel):
some_text: str
some_number: int = 10
some_boolean: bool = True
with st.form(key="pydantic_form"):
sp.pydantic_input(key="my_input_model", model=ExampleModel)
submit_button = st.f... | [
"streamlit.form",
"streamlit_pydantic.pydantic_input",
"streamlit.form_submit_button"
] | [((202, 230), 'streamlit.form', 'st.form', ([], {'key': '"""pydantic_form"""'}), "(key='pydantic_form')\n", (209, 230), True, 'import streamlit as st\n'), ((236, 295), 'streamlit_pydantic.pydantic_input', 'sp.pydantic_input', ([], {'key': '"""my_input_model"""', 'model': 'ExampleModel'}), "(key='my_input_model', model=... |
import time
from flask import current_app
from neo4j import Transaction as Neo4jTx
from neo4j.graph import Node as N4jDriverNode, Relationship as N4jDriverRelationship
from typing import Dict, List
from neo4japp.constants import (
BIOCYC_ORG_ID_DICT,
)
from neo4japp.exceptions import ServerException
from neo4japp... | [
"neo4japp.util.get_first_known_label_from_list",
"neo4japp.exceptions.ServerException",
"neo4japp.util.get_first_known_label_from_node",
"neo4japp.utils.logger.EventLog",
"time.time"
] | [((5120, 5131), 'time.time', 'time.time', ([], {}), '()\n', (5129, 5131), False, 'import time\n'), ((6090, 6101), 'time.time', 'time.time', ([], {}), '()\n', (6099, 6101), False, 'import time\n'), ((6811, 6822), 'time.time', 'time.time', ([], {}), '()\n', (6820, 6822), False, 'import time\n'), ((7581, 7592), 'time.time... |
import random
import time
random.seed(1234)
from ltron.bricks.brick_scene import BrickScene
from ltron.experts.reassembly import ReassemblyExpert
from ltron.matching import match_configurations
scene = BrickScene(renderable=True, track_snaps=True)
scene.import_ldraw(
#'~/.cache/ltron/collections/omr/ldraw/8661-1 -... | [
"random.seed",
"ltron.bricks.brick_scene.BrickScene",
"ltron.matching.match_configurations",
"time.time",
"random.randint"
] | [((26, 43), 'random.seed', 'random.seed', (['(1234)'], {}), '(1234)\n', (37, 43), False, 'import random\n'), ((203, 248), 'ltron.bricks.brick_scene.BrickScene', 'BrickScene', ([], {'renderable': '(True)', 'track_snaps': '(True)'}), '(renderable=True, track_snaps=True)\n', (213, 248), False, 'from ltron.bricks.brick_sce... |
import re
from random import randint
from typing import Any
from typing import Callable
from typing import Dict
from typing import Match
from typing import Optional
from retrying import retry
import apysc as ap
from apysc._event.custom_event_type import CustomEventType
from apysc._expression import expres... | [
"apysc._expression.expression_data_util.empty_expression",
"apysc._expression.expression_data_util.get_current_expression",
"apysc.Number",
"apysc.Timer",
"apysc.TimerEvent",
"apysc._expression.expression_data_util.get_current_event_handler_scope_expression",
"apysc._expression.expression_data_util.exec... | [((1215, 1254), 'apysc._expression.expression_data_util.empty_expression', 'expression_data_util.empty_expression', ([], {}), '()\n', (1252, 1254), False, 'from apysc._expression import expression_data_util\n'), ((1282, 1342), 'apysc.Timer', 'ap.Timer', ([], {'handler': 'self.on_timer', 'delay': '(33.3)', 'repeat_count... |
#############################
#### QR Code Generator ######
#############################
import qrcode
import cv2
qr = qrcode.QRCode(
version=1,
error_correction=qrcode.constants.ERROR_CORRECT_L,
box_size=10,
border=4,
)
f = open("am_decoded.txt","r")
lines = f.readlines()
s = ""
for line in lines:
... | [
"qrcode.QRCode"
] | [((122, 224), 'qrcode.QRCode', 'qrcode.QRCode', ([], {'version': '(1)', 'error_correction': 'qrcode.constants.ERROR_CORRECT_L', 'box_size': '(10)', 'border': '(4)'}), '(version=1, error_correction=qrcode.constants.ERROR_CORRECT_L,\n box_size=10, border=4)\n', (135, 224), False, 'import qrcode\n')] |
"""
Makes the web application modular!
"""
import os
from flask import Flask
from flask_socketio import SocketIO
from .config import configurations
app = Flask(__name__)
# Read from environment file and load local env variables
if not os.environ.get('Production', False) and not os.environ.get('TRAVIS', False):
... | [
"flask.Flask",
"os.environ.get",
"os.path.join",
"flask_socketio.SocketIO",
"os.getcwd",
"os.path.dirname"
] | [((160, 175), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (165, 175), False, 'from flask import Flask\n'), ((740, 777), 'os.environ.get', 'os.environ.get', (['"""TEST_PASSWORD"""', 'None'], {}), "('TEST_PASSWORD', None)\n", (754, 777), False, 'import os\n'), ((808, 845), 'os.environ.get', 'os.environ.ge... |
import subprocess
def init_dev_env() -> None:
cmds = [
["pipenv", "install"],
["pipenv", "install", "--dev"],
["git", "config", "commit.message", ".gitmessage"],
]
for cmd in cmds:
subprocess.run(cmd)
if __name__ == "__main__":
init_dev_env()
| [
"subprocess.run"
] | [((227, 246), 'subprocess.run', 'subprocess.run', (['cmd'], {}), '(cmd)\n', (241, 246), False, 'import subprocess\n')] |
from hack_hznu_teacher import hack_teacher
with open('teacher.txt') as file:
line = file.readline()
while line:
stu_num = line[:-1]
hack_teacher(stu_num)
line = file.readline()
| [
"hack_hznu_teacher.hack_teacher"
] | [((157, 178), 'hack_hznu_teacher.hack_teacher', 'hack_teacher', (['stu_num'], {}), '(stu_num)\n', (169, 178), False, 'from hack_hznu_teacher import hack_teacher\n')] |
import sys
n, *a = map(int, sys.stdin.read().split())
def main():
x = 0
y = sum(a)
res = []
for i in range(n - 1):
x += a[i]
y -= a[i]
res.append(abs(x - y))
return min(res)
if __name__ == "__main__":
ans = main()
print(ans)
| [
"sys.stdin.read"
] | [((31, 47), 'sys.stdin.read', 'sys.stdin.read', ([], {}), '()\n', (45, 47), False, 'import sys\n')] |
import os
import glob
import pickle
from functools import wraps
from concurrent import futures
import cv2
import numpy as np
from PIL import Image
import yaml
from matplotlib import pyplot as plt
import layoutparser as lp
from tqdm import tqdm
def detect_wrapper(fn):
@wraps(fn)
def wrap(parser, im, *args, **... | [
"cv2.rectangle",
"matplotlib.pyplot.imshow",
"os.path.exists",
"os.listdir",
"os.makedirs",
"concurrent.futures.ThreadPoolExecutor",
"os.path.join",
"functools.wraps",
"numpy.ndarray",
"os.path.basename",
"layoutparser.draw_box",
"layoutparser.Detectron2LayoutModel",
"cv2.imread",
"os.walk... | [((276, 285), 'functools.wraps', 'wraps', (['fn'], {}), '(fn)\n', (281, 285), False, 'from functools import wraps\n'), ((5933, 5955), 'os.listdir', 'os.listdir', (['models_dir'], {}), '(models_dir)\n', (5943, 5955), False, 'import os\n'), ((1103, 1117), 'cv2.imread', 'cv2.imread', (['im'], {}), '(im)\n', (1113, 1117), ... |
# ======================================================================
# Air Duct Spelunking
# Advent of Code 2016 Day 24 -- <NAME> -- https://adventofcode.com
#
# Python implementation by Dr. <NAME> III
# ======================================================================
# ====================================... | [
"ducts.Ducts"
] | [((1620, 1655), 'ducts.Ducts', 'ducts.Ducts', ([], {'text': 'text', 'part2': 'part2'}), '(text=text, part2=part2)\n', (1631, 1655), False, 'import ducts\n')] |
#! /usr/bin/env python3
# -*- coding: utf-8 -*-
import argparse
import subprocess
import shutil
import sys
import os
def parse_arguments():
formatter = lambda prog: argparse.ArgumentDefaultsHelpFormatter(
prog, max_help_position=38
)
parser = argparse.ArgumentParser(
description="Run rddl... | [
"os.path.exists",
"os.listdir",
"sys.exit",
"argparse.ArgumentDefaultsHelpFormatter",
"argparse.ArgumentParser",
"os.path.join",
"os.symlink",
"os.getcwd",
"os.mkdir",
"shutil.rmtree",
"os.path.abspath",
"os.walk"
] | [((266, 413), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Run rddlsim from directory defined by environment variable RDDLSIM_ROOT."""', 'formatter_class': 'formatter'}), "(description=\n 'Run rddlsim from directory defined by environment variable RDDLSIM_ROOT.',\n formatter_clas... |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.26 on 2020-01-25 23:47
from __future__ import unicode_literals
from django.db import migrations
from django.db.backends.postgresql_psycopg2.schema import DatabaseSchemaEditor
from django.db.migrations.state import StateApps
def upgrade_stream_post_policy(apps: State... | [
"django.db.migrations.RunPython"
] | [((878, 971), 'django.db.migrations.RunPython', 'migrations.RunPython', (['upgrade_stream_post_policy'], {'reverse_code': 'migrations.RunPython.noop'}), '(upgrade_stream_post_policy, reverse_code=migrations.\n RunPython.noop)\n', (898, 971), False, 'from django.db import migrations\n')] |
import argparse
import re
import os
import json
import numpy as np
import pickle as pkl
"""
for extracting word embedding yourself, please download pretrained model from one of the following links.
"""
url = {'glove': 'http://nlp.stanford.edu/data/glove.6B.zip',
'google': 'https://drive.google.com/file/d/0B7Xk... | [
"re.split",
"os.path.exists",
"pickle.dump",
"argparse.ArgumentParser",
"gensim.models.keyedvectors.KeyedVectors.load_word2vec_format",
"os.path.join",
"numpy.array",
"numpy.zeros",
"os.path.dirname",
"numpy.linalg.norm",
"json.load"
] | [((1563, 1582), 'numpy.array', 'np.array', (['all_feats'], {}), '(all_feats)\n', (1571, 1582), True, 'import numpy as np\n'), ((2632, 2674), 'os.path.join', 'os.path.join', (['txt_dir', '"""glove.6B.300d.txt"""'], {}), "(txt_dir, 'glove.6B.300d.txt')\n", (2644, 2674), False, 'import os\n'), ((2705, 2723), 'numpy.zeros'... |
import dateutil
from typing import List
import numpy as np
import pandas as pd
from macpie._config import get_option
from macpie import lltools, strtools
def add_diff_days(
df: pd.DataFrame, col_start: str, col_end: str, diff_days_col: str = None, inplace=False
):
"""Adds a column to DataFrame called ``_dif... | [
"macpie._config.get_option",
"macpie.strtools.strip_suffix",
"pandas.merge",
"macpie.lltools.list_like_str_equal",
"macpie.lltools.is_list_like",
"macpie.strtools.str_equals",
"numpy.invert",
"numpy.timedelta64",
"pandas.to_datetime",
"pandas.api.types.is_datetime64_any_dtype"
] | [((5815, 5840), 'numpy.invert', 'np.invert', (['cols_match_pat'], {}), '(cols_match_pat)\n', (5824, 5840), True, 'import numpy as np\n'), ((8547, 8577), 'macpie.lltools.is_list_like', 'lltools.is_list_like', (['col_name'], {}), '(col_name)\n', (8567, 8577), False, 'from macpie import lltools, strtools\n'), ((10178, 102... |
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed ... | [
"logging.getLogger",
"rally.task.types.convert",
"rally.task.atomic.action_timer",
"subprocess.Popen",
"os.path.join",
"os.path.realpath",
"rally.task.validation.add",
"rally.task.scenario.configure"
] | [((899, 926), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (916, 926), False, 'import logging\n'), ((930, 1007), 'rally.task.types.convert', 'types.convert', ([], {'image': "{'type': 'glance_image'}", 'flavor': "{'type': 'nova_flavor'}"}), "(image={'type': 'glance_image'}, flavor={'type... |
#!/usr/bin/env python3
import argparse
import pytest
import datetime
import dateutil
from dateutil.parser import parse
import os
legal_days_of_week="MTWRF"
def mkdir_p(newdir):
"""works the way a good mkdir should :)
- already exists, silently complete
- regular file in the way, raise an exceptio... | [
"dateutil.parser.parse",
"os.path.join",
"os.path.split",
"os.path.isfile",
"os.path.isdir",
"os.mkdir",
"datetime.timedelta"
] | [((610, 631), 'os.path.isdir', 'os.path.isdir', (['newdir'], {}), '(newdir)\n', (623, 631), False, 'import os\n'), ((1292, 1319), 'dateutil.parser.parse', 'dateutil.parser.parse', (['date'], {}), '(date)\n', (1313, 1319), False, 'import dateutil\n'), ((2220, 2249), 'datetime.timedelta', 'datetime.timedelta', ([], {'day... |
from model import model
# Calculate probability for a given observation
probability = model.probability([["none", "no", "on time", "attend"]])
print(probability)
| [
"model.model.probability"
] | [((87, 143), 'model.model.probability', 'model.probability', (["[['none', 'no', 'on time', 'attend']]"], {}), "([['none', 'no', 'on time', 'attend']])\n", (104, 143), False, 'from model import model\n')] |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Sat Nov 3 21:06:23 2018
@author: <NAME>
"""
import numpy as np
from metodos_numericos.LU import LU
from metodos_numericos.Gauss import Gauss
#from Utils import Utils
#from TabelaGauss import TabelaGauss
from TabelaGaussLegendre import TabelaGaussLegendre
... | [
"numpy.float64",
"numpy.zeros",
"metodos_numericos.LU.LU",
"TabelaGaussLegendre.TabelaGaussLegendre"
] | [((467, 505), 'numpy.zeros', 'np.zeros', (['(tam, tam)'], {'dtype': 'np.float64'}), '((tam, tam), dtype=np.float64)\n', (475, 505), True, 'import numpy as np\n'), ((517, 551), 'numpy.zeros', 'np.zeros', (['(tam,)'], {'dtype': 'np.float64'}), '((tam,), dtype=np.float64)\n', (525, 551), True, 'import numpy as np\n'), ((1... |
import os
import tkinter as tk
from hope2 import launcher
from tkinter import ttk
from framework import tk_utils as tku
from framework import utils
from app.my import img
from app.my import Color
from app.my import String
from app.my import Font
# from scipy.misc import imsave
import time
wo... | [
"hope2.launcher.run.upscale",
"framework.tk_utils.ImageLabel",
"tkinter.ttk.Scrollbar",
"framework.utils.strftime",
"tkinter.Button",
"framework.tk_utils.WinBase.__init__",
"tkinter.Label",
"os.startfile",
"framework.tk_utils.show_confirm",
"tkinter.Frame",
"framework.tk_utils.label",
"os.path... | [((565, 591), 'framework.tk_utils.WinBase.__init__', 'tku.WinBase.__init__', (['self'], {}), '(self)\n', (585, 591), True, 'from framework import tk_utils as tku\n'), ((1120, 1148), 'tkinter.Frame', 'tk.Frame', (['parent'], {'bg': '"""black"""'}), "(parent, bg='black')\n", (1128, 1148), True, 'import tkinter as tk\n'),... |
import math
import operator
from functools import reduce
import bezier
import cv2
import numpy as np
import pyclipper
from pyclipper import PyclipperOffset
from scipy.interpolate import splprep, splev
from shapely.geometry import Polygon
def compute_two_points_angle(_base_point, _another_point):
"""
以基点作x轴延长... | [
"numpy.clip",
"numpy.hstack",
"numpy.argsort",
"numpy.array",
"shapely.geometry.Polygon",
"numpy.arctan2",
"numpy.linalg.norm",
"numpy.sin",
"math.atan",
"numpy.atleast_2d",
"numpy.mean",
"numpy.reshape",
"numpy.where",
"numpy.putmask",
"numpy.max",
"cv2.minAreaRect",
"numpy.stack",
... | [((1237, 1286), 'scipy.interpolate.splprep', 'splprep', (['_points.T'], {'u': 'None', 's': '(1.0)', 'per': '(1)', 'quiet': '(2)'}), '(_points.T, u=None, s=1.0, per=1, quiet=2)\n', (1244, 1286), False, 'from scipy.interpolate import splprep, splev\n'), ((1354, 1378), 'scipy.interpolate.splev', 'splev', (['u_new', 'tck']... |
"""
Models in the database
"""
import sqlalchemy as sa
from sqlalchemy.engine import URL
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.sql.schema import UniqueConstraint, PrimaryKeyConstraint # , ForeignKey
from settings import DB_CONN_STR
from . import (
SQL_T_ARTICLE,
SQL_T_BOM,... | [
"sqlalchemy.FLOAT",
"sqlalchemy.engine.URL.create",
"sqlalchemy.VARCHAR",
"sqlalchemy.create_engine",
"sqlalchemy.Text",
"sqlalchemy.CHAR",
"sqlalchemy.INTEGER",
"sqlalchemy.sql.schema.PrimaryKeyConstraint",
"sqlalchemy.sql.schema.UniqueConstraint",
"sqlalchemy.ext.declarative.declarative_base",
... | [((404, 467), 'sqlalchemy.engine.URL.create', 'URL.create', (['"""mssql+pyodbc"""'], {'query': "{'odbc_connect': DB_CONN_STR}"}), "('mssql+pyodbc', query={'odbc_connect': DB_CONN_STR})\n", (414, 467), False, 'from sqlalchemy.engine import URL\n'), ((478, 533), 'sqlalchemy.create_engine', 'sa.create_engine', (['conn_url... |
from math import sqrt
import matplotlib.pyplot as p
def is_prime(n):
result = True
if n%2 == 0:
return(False)
for i in range(3,int(sqrt(n)) + 1,2):
if n%i == 0:
result = False
break
return(result)
def f(n):
binary_string_n = bin(n)[2:]
bin... | [
"math.sqrt",
"matplotlib.pyplot.scatter",
"matplotlib.pyplot.show"
] | [((769, 797), 'matplotlib.pyplot.scatter', 'p.scatter', (['x_cor', 'y_cor'], {'s': '(2)'}), '(x_cor, y_cor, s=2)\n', (778, 797), True, 'import matplotlib.pyplot as p\n'), ((931, 939), 'matplotlib.pyplot.show', 'p.show', ([], {}), '()\n', (937, 939), True, 'import matplotlib.pyplot as p\n'), ((159, 166), 'math.sqrt', 's... |
# -*- coding: UTF-8 -*-
"""
spanning_tree
=============
Script: spanning_tree.py
Author: <EMAIL>
Modified: 2018-06-13
Original: ... mst.py in my github
extensive documentation is there.
Purpose:
--------
Produce a spanning tree from a point set. I have yet to confirm
whether it constitutes ... | [
"numpy.prod",
"arcpytools_pnt.fc_info",
"arcpy.CopyFeatures_management",
"textwrap.dedent",
"numpy.set_printoptions",
"arcpy.Point",
"arcpy.da.FeatureClassToNumPyArray",
"arcpytools_pnt.tweet",
"numpy.lexsort",
"numpy.zeros",
"arcpy.Exists",
"numpy.einsum",
"numpy.vstack",
"arcpy.Delete_ma... | [((4260, 4369), 'numpy.set_printoptions', 'np.set_printoptions', ([], {'edgeitems': '(10)', 'linewidth': '(100)', 'precision': '(2)', 'suppress': '(True)', 'threshold': '(120)', 'formatter': 'ft'}), '(edgeitems=10, linewidth=100, precision=2, suppress=True,\n threshold=120, formatter=ft)\n', (4279, 4369), True, 'imp... |
import time
from arraySort import arraySort
from Char_arraysort import arraySortStrings
from random import randint
#Equal to quicksort in array size 50000 & max 50000
#Better than quicksort in array size 500000 & max 100000
def partition(arr,low,high):
i = ( low-1 )
pivot = arr[high]
for ... | [
"arraySort.arraySort",
"time.time",
"random.randint"
] | [((949, 960), 'time.time', 'time.time', ([], {}), '()\n', (958, 960), False, 'import time\n'), ((965, 984), 'arraySort.arraySort', 'arraySort', (['arr_copy'], {}), '(arr_copy)\n', (974, 984), False, 'from arraySort import arraySort\n'), ((996, 1007), 'time.time', 'time.time', ([], {}), '()\n', (1005, 1007), False, 'imp... |
import CaboCha
class Kongming:
def __init__(self, stopwords=None):
self.cabocha = CaboCha.Parser()
self.stopwords = stopwords
def _get_modifier(self, tree, chunk):
surface = ''
for i in range(chunk.token_pos, chunk.token_pos + chunk.head_pos + 1):
token = tree.tok... | [
"CaboCha.Parser"
] | [((97, 113), 'CaboCha.Parser', 'CaboCha.Parser', ([], {}), '()\n', (111, 113), False, 'import CaboCha\n')] |
# Copyright 2015 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import logging
import re
from pylib import cmd_helper
_INDENTATION_RE = re.compile(r'^( *)')
_LSUSB_BUS_DEVICE_RE = re.compile(r'^Bus (\d{3}) Device (\d{3}... | [
"pylib.cmd_helper.GetCmdOutput",
"logging.error",
"re.compile"
] | [((237, 256), 're.compile', 're.compile', (['"""^( *)"""'], {}), "('^( *)')\n", (247, 256), False, 'import re\n'), ((281, 325), 're.compile', 're.compile', (['"""^Bus (\\\\d{3}) Device (\\\\d{3}):"""'], {}), "('^Bus (\\\\d{3}) Device (\\\\d{3}):')\n", (291, 325), False, 'import re\n'), ((343, 388), 're.compile', 're.co... |
"""
MIT License
Copyright (c) 2019 Shortty10
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, publish, dis... | [
"json.load",
"scraper.scrape",
"comparison.compare",
"json.dump"
] | [((2761, 2783), 'comparison.compare', 'compare', (['movies', 'cache'], {}), '(movies, cache)\n', (2768, 2783), False, 'from comparison import compare\n'), ((2526, 2539), 'scraper.scrape', 'scrape', (['movie'], {}), '(movie)\n', (2532, 2539), False, 'from scraper import scrape\n'), ((1730, 1745), 'json.load', 'json.load... |
import re
import config
from helper.DatabaseHelper import Player
from nonebot import on_command, CommandSession,permission
__plugin_name__ = '解除绑定'
__plugin_usage__ = r"""解除绑定(仅管理及群主可用)
例:#解绑 @一个人
或 #unbind 艾特一个人"""
@on_command('unbind', aliases='解绑', only_to_me=False, permission=permission.SUPERUSER | permission.GR... | [
"nonebot.on_command",
"helper.DatabaseHelper.Player"
] | [((220, 360), 'nonebot.on_command', 'on_command', (['"""unbind"""'], {'aliases': '"""解绑"""', 'only_to_me': '(False)', 'permission': '(permission.SUPERUSER | permission.GROUP_OWNER | permission.GROUP_ADMIN)'}), "('unbind', aliases='解绑', only_to_me=False, permission=permission.\n SUPERUSER | permission.GROUP_OWNER | p... |
from glob import glob
import matplotlib.pyplot as plt
"""
What is AFPO?
In the optimization algorithm AFPO (Age-Fitness Pareto Optimization), randomly generated candidate designs (solutions)
are injected into the population each generation with age zero. Every generation, modified copies are made of each
design in ... | [
"matplotlib.pyplot.savefig",
"matplotlib.pyplot.subplots",
"glob.glob"
] | [((1652, 1679), 'glob.glob', 'glob', (["(RUN_DIR + 'Gen_*.txt')"], {}), "(RUN_DIR + 'Gen_*.txt')\n", (1656, 1679), False, 'from glob import glob\n'), ((2729, 2763), 'matplotlib.pyplot.subplots', 'plt.subplots', (['(1)', '(1)'], {'figsize': '(4, 3)'}), '(1, 1, figsize=(4, 3))\n', (2741, 2763), True, 'import matplotlib.p... |
from flask import render_template, Blueprint
from flask_login import current_user, login_required
from mast.models import Competition
from mast.queries import Queries
from mast.session import Session
from mast.activities.utils import ordinal
from mast.tools.utils import check_profile_verified
activities = Blueprint('a... | [
"flask.render_template",
"mast.session.Session",
"mast.activities.utils.ordinal",
"mast.tools.utils.check_profile_verified",
"mast.queries.Queries",
"flask.Blueprint"
] | [((308, 341), 'flask.Blueprint', 'Blueprint', (['"""activities"""', '__name__'], {}), "('activities', __name__)\n", (317, 341), False, 'from flask import render_template, Blueprint\n'), ((424, 433), 'mast.queries.Queries', 'Queries', ([], {}), '()\n', (431, 433), False, 'from mast.queries import Queries\n'), ((1393, 14... |
# Copyright (c) 2013 Red Hat 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 writi... | [
"mock.patch",
"sahara.service.validations.edp.job_executor.check_job_executor",
"uuid.uuid4"
] | [((795, 825), 'sahara.service.validations.edp.job_executor.check_job_executor', 'je.check_job_executor', (['data', '(0)'], {}), '(data, 0)\n', (816, 825), True, 'from sahara.service.validations.edp import job_executor as je\n'), ((1117, 1184), 'mock.patch', 'mock.patch', (['"""sahara.service.validations.base.check_edp_... |
from contextlib import suppress
from typing import Callable, Union, Iterable, List, Optional, Tuple
import tensorflow as tf
import tensorflow_probability as tfp
import numpy as np
import zfit
from zfit import ztf
from zfit.core.interfaces import ZfitPDF
from zfit.util import ztyping
from zfit.util.exception import Sh... | [
"tensorflow.shape",
"tensorflow.boolean_mask",
"tensorflow.assert_greater_equal",
"tensorflow.control_dependencies",
"tensorflow.Session",
"tensorflow.random.shuffle",
"tensorflow_probability.mcmc.HamiltonianMonteCarlo",
"tensorflow.concat",
"tensorflow_probability.distributions.Normal",
"numpy.av... | [((6198, 6212), 'tensorflow.to_int64', 'tf.to_int64', (['n'], {}), '(n)\n', (6209, 6212), True, 'import tensorflow as tf\n'), ((12919, 12945), 'tensorflow.concat', 'tf.concat', (['samples'], {'axis': '(0)'}), '(samples, axis=0)\n', (12928, 12945), True, 'import tensorflow as tf\n'), ((673, 702), 'zfit.ztf.constant', 'z... |
import unittest
from autosklearn.pipeline.components.regression.decision_tree import DecisionTree
from autosklearn.pipeline.util import _test_regressor
import sklearn.metrics
class DecisionTreetComponentTest(unittest.TestCase):
def test_default_configuration(self):
for i in range(2):
predict... | [
"autosklearn.pipeline.util._test_regressor"
] | [((336, 365), 'autosklearn.pipeline.util._test_regressor', '_test_regressor', (['DecisionTree'], {}), '(DecisionTree)\n', (351, 365), False, 'from autosklearn.pipeline.util import _test_regressor\n'), ((677, 719), 'autosklearn.pipeline.util._test_regressor', '_test_regressor', (['DecisionTree'], {'sparse': '(True)'}), ... |
import unittest
from player import Player
class PlayerTest(unittest.TestCase):
def setUp(self):
self.player_1 = Player()
def test_when_the_players_input_its_out_of_range(self):
previous_len = len(self.player_1.choices)
self.player_1.add_choice('C4')
last_len = len(se... | [
"unittest.main",
"player.Player"
] | [((2234, 2249), 'unittest.main', 'unittest.main', ([], {}), '()\n', (2247, 2249), False, 'import unittest\n'), ((127, 135), 'player.Player', 'Player', ([], {}), '()\n', (133, 135), False, 'from player import Player\n')] |
from ldclient.config import BigSegmentsConfig
from ldclient.evaluation import BigSegmentsStatus
from ldclient.impl.big_segments import BigSegmentStoreManager, _hash_for_user_key
from ldclient.interfaces import BigSegmentStoreMetadata
from testing.mock_components import MockBigSegmentStore
from queue import Queue
impor... | [
"ldclient.config.BigSegmentsConfig",
"ldclient.impl.big_segments._hash_for_user_key",
"time.sleep",
"testing.mock_components.MockBigSegmentStore",
"queue.Queue"
] | [((362, 390), 'ldclient.impl.big_segments._hash_for_user_key', '_hash_for_user_key', (['user_key'], {}), '(user_key)\n', (380, 390), False, 'from ldclient.impl.big_segments import BigSegmentStoreManager, _hash_for_user_key\n'), ((523, 544), 'testing.mock_components.MockBigSegmentStore', 'MockBigSegmentStore', ([], {}),... |
# Status: ported.
# Base revision: 64429.
#
# Copyright (c) 2005-2010 <NAME>.
#
# Use, modification and distribution is subject to the Boost Software
# License Version 1.0. (See accompanying file LICENSE_1_0.txt or
# http://www.boost.org/LICENSE_1_0.txt)
import b2.build.type as type
import b2.build.gen... | [
"b2.build.virtual_target.NotFileTarget",
"b2.util.bjam_signature",
"b2.build.toolset.flags",
"b2.build.type.register",
"b2.manager.get_manager",
"b2.build.targets.create_typed_metatarget"
] | [((541, 570), 'b2.build.type.register', 'type.register', (['"""NOTFILE_MAIN"""'], {}), "('NOTFILE_MAIN')\n", (554, 570), True, 'import b2.build.type as type\n'), ((1170, 1226), 'b2.build.toolset.flags', 'toolset.flags', (['"""notfile.run"""', '"""ACTION"""', '[]', "['<action>']"], {}), "('notfile.run', 'ACTION', [], ['... |
import pytest
from loan_calculator.grossup.iof import IofGrossup
def test_trivial_iof_grossup(loan):
iof_grossup = IofGrossup(
loan,
loan.start_date,
daily_iof_aliquot=0.0,
complementary_iof_aliquot=0.0,
service_fee_aliquot=0.0,
)
assert iof_grossup.grossed_up_pr... | [
"pytest.approx",
"loan_calculator.grossup.iof.IofGrossup"
] | [((123, 239), 'loan_calculator.grossup.iof.IofGrossup', 'IofGrossup', (['loan', 'loan.start_date'], {'daily_iof_aliquot': '(0.0)', 'complementary_iof_aliquot': '(0.0)', 'service_fee_aliquot': '(0.0)'}), '(loan, loan.start_date, daily_iof_aliquot=0.0,\n complementary_iof_aliquot=0.0, service_fee_aliquot=0.0)\n', (133... |
from setuptools import setup
setup(
name='scrapper',
version='0.1.0',
packages=['scrapper', 'scrapper.model', 'scrapper.utils', 'scrapper.walker'],
url='https://github.com/karol-brejna-i/excel-schedule-scrapper',
license='Apache 2.0',
author='gruby',
author_email='',
description='For pe... | [
"setuptools.setup"
] | [((30, 356), 'setuptools.setup', 'setup', ([], {'name': '"""scrapper"""', 'version': '"""0.1.0"""', 'packages': "['scrapper', 'scrapper.model', 'scrapper.utils', 'scrapper.walker']", 'url': '"""https://github.com/karol-brejna-i/excel-schedule-scrapper"""', 'license': '"""Apache 2.0"""', 'author': '"""gruby"""', 'author... |
import json
import mock
'''
Mock Request and Response objects needed for many tests.
'''
class MockRequest(object):
'''
This is a mocked Request object containing only an url,
as this is the only attribute accessed during the tests.
There is a default value for it, but it can also be passed.
'''
... | [
"json.dumps",
"mock.MagicMock"
] | [((5913, 5953), 'mock.MagicMock', 'mock.MagicMock', ([], {'return_value': 'self.config'}), '(return_value=self.config)\n', (5927, 5953), False, 'import mock\n'), ((5982, 6020), 'mock.MagicMock', 'mock.MagicMock', ([], {'return_value': 'self.user'}), '(return_value=self.user)\n', (5996, 6020), False, 'import mock\n'), (... |
#!/usr/bin/env python
# -*- coding:utf-8 -*-
# author:dabai time:2019/2/22
import pygame
from pygame.sprite import Sprite
class Ship(Sprite):
def __init__(self,ai_settings,screen):
"""初始化飞船并设置其初始位置"""
super().__init__()
self.screen=screen
self.ai_settings=ai_setting... | [
"pygame.image.load"
] | [((370, 439), 'pygame.image.load', 'pygame.image.load', (['"""F:/python/Project/alien_invasion/images/ship.bmp"""'], {}), "('F:/python/Project/alien_invasion/images/ship.bmp')\n", (387, 439), False, 'import pygame\n')] |
import requests
import json
def url(path):
return '{}{}'.format('http://149.56.96.236:8002', path)
def get_nonce():
resp = requests.get(url('/init'), headers={
'Content-type': 'application/json',
'Authorization':'init'
})
if resp.status_code == 200:
return resp.json()['re... | [
"json.dumps"
] | [((605, 621), 'json.dumps', 'json.dumps', (['data'], {}), '(data)\n', (615, 621), False, 'import json\n'), ((1175, 1191), 'json.dumps', 'json.dumps', (['data'], {}), '(data)\n', (1185, 1191), False, 'import json\n')] |
"""
Find the largest Python source file on the module import search path.
Skip already-visited directories, normalize path and case so they will
match properly, and include line counts in pprinted result. It's not
enough to use os.environ['PYTHONPATH']: this is a subset of sys.path.
"""
import sys, os, pprint
trace = ... | [
"os.path.getsize",
"os.path.join",
"os.path.normpath",
"sys.exc_info",
"os.path.normcase",
"pprint.pprint",
"os.walk"
] | [((1227, 1254), 'pprint.pprint', 'pprint.pprint', (['allsizes[:3]'], {}), '(allsizes[:3])\n', (1240, 1254), False, 'import sys, os, pprint\n'), ((1255, 1283), 'pprint.pprint', 'pprint.pprint', (['allsizes[-3:]'], {}), '(allsizes[-3:])\n', (1268, 1283), False, 'import sys, os, pprint\n'), ((1340, 1367), 'pprint.pprint',... |
import uuid
import imghdr
import os
from cStringIO import StringIO
from flask import Flask, request, redirect, render_template, url_for, flash, jsonify
from flask_s3 import FlaskS3
import boto3
import requests
from cat import CatThat
FINISHED_FOLDER = 'finished'
S3_BUCKET = 'cats.databeard.com'
ALLOWED_EXTENSIONS = ... | [
"flask.render_template",
"flask.request.args.get",
"cStringIO.StringIO",
"boto3.client",
"flask.flash",
"flask.Flask",
"cat.CatThat",
"flask_s3.FlaskS3",
"os.environ.get",
"requests.get",
"uuid.uuid4",
"flask.request.form.get",
"flask.url_for",
"flask.jsonify"
] | [((357, 372), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (362, 372), False, 'from flask import Flask, request, redirect, render_template, url_for, flash, jsonify\n'), ((400, 434), 'os.environ.get', 'os.environ.get', (['"""FLASK_SECRET_KEY"""'], {}), "('FLASK_SECRET_KEY')\n", (414, 434), False, 'import ... |
import torch
from torch.utils.data import TensorDataset, DataLoader
from sklearn.preprocessing import StandardScaler
# Generate time windows for time series forecasting with LSTM network
def generate_window(dataset, label, train_window, pred_horizon):
dataset_seq = []
size = len(dataset)
x_arr = []
y_... | [
"sklearn.preprocessing.StandardScaler",
"torch.tensor",
"torch.utils.data.TensorDataset",
"torch.utils.data.DataLoader"
] | [((882, 915), 'torch.utils.data.TensorDataset', 'TensorDataset', (['x_tensor', 'y_tensor'], {}), '(x_tensor, y_tensor)\n', (895, 915), False, 'from torch.utils.data import TensorDataset, DataLoader\n'), ((940, 985), 'torch.utils.data.DataLoader', 'DataLoader', (['tensor_dataset', 'batch_size', '(False)'], {}), '(tensor... |
import threading
import time
order_producer=['Pizza','McCrispy','McFries','Crosont','Doughnut']
order=[]
j=0
i=0
serve=[]
while(i<len(order_producer)):
order.insert(i,order_producer[i])
print(order[i])
time.sleep(0.5)
i=i+1
print('Your Order is Preparing ')
while(j<len(or... | [
"time.sleep"
] | [((234, 249), 'time.sleep', 'time.sleep', (['(0.5)'], {}), '(0.5)\n', (244, 249), False, 'import time\n'), ((355, 368), 'time.sleep', 'time.sleep', (['(2)'], {}), '(2)\n', (365, 368), False, 'import time\n')] |
import logging
from optparse import make_option
from django.core.management.base import NoArgsCommand
from django.db.models import Max
from laws.models import GovProposal
from simple.parsers import parse_laws
logger = logging.getLogger("open-knesset.parse_laws")
def scrape_gov_proposals(use_last_booklet, specific_... | [
"logging.getLogger",
"laws.models.GovProposal.objects.filter",
"simple.parsers.parse_laws.ParseGovLaws",
"optparse.make_option",
"django.db.models.Max"
] | [((221, 265), 'logging.getLogger', 'logging.getLogger', (['"""open-knesset.parse_laws"""'], {}), "('open-knesset.parse_laws')\n", (238, 265), False, 'import logging\n'), ((557, 589), 'simple.parsers.parse_laws.ParseGovLaws', 'parse_laws.ParseGovLaws', (['booklet'], {}), '(booklet)\n', (580, 589), False, 'from simple.pa... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
##
## @author <NAME>
##
## @copyright 2017, <NAME>, all right reserved
##
## @license APACHE v2.0 (see license file)
##
import os
import sys
import fnmatch
import copy
from . import debug
from . import arg as arguments
from . import env
from . import tools
from . import module
... | [
"os.listdir",
"os.path.join",
"os.path.isfile",
"os.path.dirname",
"pkg_resources.get_distribution",
"os.walk"
] | [((1466, 1491), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (1481, 1491), False, 'import os\n'), ((2780, 2793), 'os.walk', 'os.walk', (['path'], {}), '(path)\n', (2787, 2793), False, 'import os\n'), ((3569, 3599), 'os.path.isfile', 'os.path.isfile', (['argument_value'], {}), '(argument_val... |
from django.db import models
from django.urls import reverse
from netbox.models import PrimaryModel, TaggableManager
from utilities.querysets import RestrictedQuerySet
class NameServer(PrimaryModel):
name = models.CharField(unique=True, max_length=255)
objects = RestrictedQuerySet.as_manager()
class Met... | [
"netbox.models.TaggableManager",
"django.db.models.ForeignKey",
"django.db.models.ManyToManyField",
"utilities.querysets.RestrictedQuerySet.as_manager",
"django.db.models.PositiveIntegerField",
"django.urls.reverse",
"django.db.models.CharField"
] | [((213, 258), 'django.db.models.CharField', 'models.CharField', ([], {'unique': '(True)', 'max_length': '(255)'}), '(unique=True, max_length=255)\n', (229, 258), False, 'from django.db import models\n'), ((274, 305), 'utilities.querysets.RestrictedQuerySet.as_manager', 'RestrictedQuerySet.as_manager', ([], {}), '()\n',... |