code stringlengths 22 1.05M | apis listlengths 1 3.31k | extract_api stringlengths 75 3.25M |
|---|---|---|
import numpy
from sklearn import preprocessing
def linear(intrinsic_process):
assert intrinsic_process.shape[0] == 2
observed_process = numpy.empty((3, intrinsic_process.shape[1]), dtype=numpy.float64)
observed_process[0] = intrinsic_process[0]
observed_process[1] = intrinsic_process[1]
observed_p... | [
"numpy.copy",
"numpy.mean",
"numpy.sqrt",
"numpy.power",
"numpy.where",
"numpy.max",
"numpy.angle",
"numpy.sum",
"numpy.zeros",
"numpy.exp",
"numpy.empty",
"numpy.sign",
"numpy.cos",
"numpy.min",
"numpy.sin",
"sklearn.preprocessing.MinMaxScaler",
"numpy.arctan"
] | [((146, 211), 'numpy.empty', 'numpy.empty', (['(3, intrinsic_process.shape[1])'], {'dtype': 'numpy.float64'}), '((3, intrinsic_process.shape[1]), dtype=numpy.float64)\n', (157, 211), False, 'import numpy\n'), ((473, 502), 'numpy.copy', 'numpy.copy', (['intrinsic_process'], {}), '(intrinsic_process)\n', (483, 502), Fals... |
# -*- coding: utf-8 -*-
"""Unit tests for Response class"""
import pytest
from ga4gh.refget.http.response import Response
from ga4gh.refget.http.status_codes import StatusCodes as SC
from ga4gh.refget.config.constants import CONTENT_TYPE_JSON_REFGET_VND, \
CONTENT_TYPE_TEXT_REFGET_VND
testdata_body = [
("ACGT... | [
"pytest.mark.parametrize",
"ga4gh.refget.http.response.Response"
] | [((935, 981), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""body"""', 'testdata_body'], {}), "('body', testdata_body)\n", (958, 981), False, 'import pytest\n'), ((1098, 1158), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""status_code"""', 'testdata_status_code'], {}), "('status_code', testda... |
import typing
from functools import partial as bind
from cohesivenet import (
data_types,
network_math,
Logger,
util,
VNS3Client,
CohesiveSDKException,
)
from cohesivenet.macros import api_operations, state
VNS3Attr = state.VNS3Attr
def create_local_gateway_route(client, local_cidr, **rout... | [
"cohesivenet.macros.api_operations.__bulk_call_api",
"cohesivenet.network_math.get_default_gateway",
"cohesivenet.macros.state.fetch_client_state_attribute",
"cohesivenet.macros.state.get_primary_private_ip",
"cohesivenet.util.format_string",
"functools.partial",
"cohesivenet.network_math.subnet_contain... | [((984, 1059), 'cohesivenet.macros.api_operations.try_call_api', 'api_operations.try_call_api', (['client.routing.post_create_route'], {}), '(client.routing.post_create_route, **api_kwargs)\n', (1011, 1059), False, 'from cohesivenet.macros import api_operations, state\n'), ((4205, 4281), 'cohesivenet.macros.api_operati... |
import sys
import numpy as np
from timeit import default_timer as timer
start = None
end = None
A = np.asmatrix(sys.argv[1])
A = A.astype(float)
I = np.identity(A.shape[0], dtype=float)
N = np.concatenate((A, I),axis=1)
start = timer()
# itera as colunas
for c in range(0, A.shape[1] - 1):
#procura coluna pivô nã... | [
"numpy.identity",
"numpy.copy",
"numpy.asmatrix",
"timeit.default_timer",
"numpy.concatenate"
] | [((102, 126), 'numpy.asmatrix', 'np.asmatrix', (['sys.argv[1]'], {}), '(sys.argv[1])\n', (113, 126), True, 'import numpy as np\n'), ((151, 187), 'numpy.identity', 'np.identity', (['A.shape[0]'], {'dtype': 'float'}), '(A.shape[0], dtype=float)\n', (162, 187), True, 'import numpy as np\n'), ((192, 222), 'numpy.concatenat... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
from pathlib import Path
from nonebot.drivers.fastapi import Driver
from fastapi.staticfiles import StaticFiles
from nonebot_plugin_test import (TEST_HTML_PATH, TEST_WS_PATH, TEST_INFO_PATH,
TEST_PLUGIN_PATH, TEST_MATCHER_PATH,
... | [
"fastapi.staticfiles.StaticFiles",
"pathlib.Path"
] | [((935, 980), 'fastapi.staticfiles.StaticFiles', 'StaticFiles', ([], {'directory': 'static_path', 'html': '(True)'}), '(directory=static_path, html=True)\n', (946, 980), False, 'from fastapi.staticfiles import StaticFiles\n'), ((627, 641), 'pathlib.Path', 'Path', (['__file__'], {}), '(__file__)\n', (631, 641), False, '... |
import click
def scrape_overflow(query, sources, answers):
"""
{
"title": "string",
"votes": int,
"answers": [
{
"text": "string",
"votes": int,
"author": "string",
"date": "string" or datetime
}
... | [
"click.option",
"click.echo",
"click.argument",
"click.command"
] | [((523, 538), 'click.command', 'click.command', ([], {}), '()\n', (536, 538), False, 'import click\n'), ((540, 588), 'click.argument', 'click.argument', (['"""query"""'], {'nargs': '(-1)', 'required': '(True)'}), "('query', nargs=-1, required=True)\n", (554, 588), False, 'import click\n'), ((590, 690), 'click.option', ... |
#
# 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 under... | [
"ironic.drivers.modules.deploy_utils.prepare_inband_cleaning"
] | [((1658, 1718), 'ironic.drivers.modules.deploy_utils.prepare_inband_cleaning', 'deploy_utils.prepare_inband_cleaning', (['task'], {'manage_boot': '(True)'}), '(task, manage_boot=True)\n', (1694, 1718), False, 'from ironic.drivers.modules import deploy_utils\n')] |
#!/usr/bin/env python
# coding: utf-8
# # NumPy
#
#
# In[32]:
# NumPy is a library for scientific computations in Python.
# Numpy is one of the packages you have to know if you're going to do data science with Python.
# It is a Python library that provides support for large, multidimensional arrays along with ma... | [
"numpy.eye",
"numpy.ones",
"numpy.hstack",
"numpy.random.random",
"numpy.array",
"numpy.zeros",
"numpy.linspace",
"numpy.vstack",
"numpy.concatenate",
"numpy.full",
"numpy.dtype",
"numpy.transpose",
"numpy.arange"
] | [((1485, 1504), 'numpy.array', 'np.array', (['[1, 2, 3]'], {}), '([1, 2, 3])\n', (1493, 1504), True, 'import numpy as np\n'), ((1507, 1552), 'numpy.array', 'np.array', (['[(1, 2, 3), (6, 7, 8)]'], {'dtype': 'float'}), '([(1, 2, 3), (6, 7, 8)], dtype=float)\n', (1515, 1552), True, 'import numpy as np\n'), ((1553, 1625),... |
# -*- coding: utf-8 -*-
# @Time : 19-6-20 下午2:16
# @Author : zj
import pickle
def save_params(params, path='params.pkl'):
with open(path, 'wb') as f:
pickle.dump(params, f, -1)
def load_params(path='params.pkl'):
with open(path, 'rb') as f:
param = pickle.load(f)
return param
if... | [
"pickle.load",
"pickle.dump"
] | [((171, 197), 'pickle.dump', 'pickle.dump', (['params', 'f', '(-1)'], {}), '(params, f, -1)\n', (182, 197), False, 'import pickle\n'), ((284, 298), 'pickle.load', 'pickle.load', (['f'], {}), '(f)\n', (295, 298), False, 'import pickle\n')] |
#!/usr/bin/env python
from setuptools import setup, find_packages
setup(
name = "test-out",
version = "0.1.5",
description = "Python class to provide helpful logging, test run data and summary statistics for automated tests.",
author = "<NAME>",
author_email = "<EMAIL>",
url = "https://github.... | [
"setuptools.find_packages"
] | [((420, 435), 'setuptools.find_packages', 'find_packages', ([], {}), '()\n', (433, 435), False, 'from setuptools import setup, find_packages\n')] |
import numpy as np
from molsysmt._private_tools.exceptions import *
from molsysmt.tools.items import compatibles_for_a_single_molecular_system as items_compatibles_for_a_single_molecular_system
from molsysmt._private_tools.lists_and_tuples import is_list_or_tuple
def is_a_single_molecular_system(items):
if is_lis... | [
"molsysmt.tools.items.compatibles_for_a_single_molecular_system",
"molsysmt._private_tools.lists_and_tuples.is_list_or_tuple",
"molsysmt.multitool.get_form"
] | [((314, 337), 'molsysmt._private_tools.lists_and_tuples.is_list_or_tuple', 'is_list_or_tuple', (['items'], {}), '(items)\n', (330, 337), False, 'from molsysmt._private_tools.lists_and_tuples import is_list_or_tuple\n'), ((448, 502), 'molsysmt.tools.items.compatibles_for_a_single_molecular_system', 'items_compatibles_fo... |
import sys
sys.path.append('/vagrant/nca47')
from nca47.common import service as nca47_service
from nca47.manager import service
from nca47.agent.agentFlag import agent_config
def main():
nca47_service.prepare_service(sys.argv)
# Build and start the WSGi app
launcher = nca47_service.process_launcher()
... | [
"nca47.common.service.prepare_service",
"nca47.common.service.process_launcher",
"nca47.agent.agentFlag.agent_config.getAgent_config",
"nca47.manager.service.DNSService",
"sys.path.append"
] | [((11, 44), 'sys.path.append', 'sys.path.append', (['"""/vagrant/nca47"""'], {}), "('/vagrant/nca47')\n", (26, 44), False, 'import sys\n'), ((195, 234), 'nca47.common.service.prepare_service', 'nca47_service.prepare_service', (['sys.argv'], {}), '(sys.argv)\n', (224, 234), True, 'from nca47.common import service as nca... |
# Generated by Django 4.0.3 on 2022-03-10 15:16
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='Kegiatan',
fields=[
('id', models.BigAutoFi... | [
"django.db.models.DateTimeField",
"django.db.models.ManyToManyField",
"django.db.models.CharField",
"django.db.models.BigAutoField"
] | [((304, 400), '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", (323, 400), False, 'from django.db import migrations, m... |
from pykafka import KafkaClient
import pykafka
from pykafka.common import OffsetType
from pykafka.protocol import PartitionOffsetCommitRequest, CreateTopicRequest
from pykafka.utils.compat import PY3, iteritems
import datetime as dt
class Monitor:
def __init__(self, kafka_brokers=['localhost:9092']):
self.client = ... | [
"datetime.datetime.strptime",
"pykafka.utils.compat.iteritems"
] | [((1639, 1657), 'pykafka.utils.compat.iteritems', 'iteritems', (['brokers'], {}), '(brokers)\n', (1648, 1657), False, 'from pykafka.utils.compat import PY3, iteritems\n'), ((3805, 3824), 'pykafka.utils.compat.iteritems', 'iteritems', (['pid_dict'], {}), '(pid_dict)\n', (3814, 3824), False, 'from pykafka.utils.compat im... |
from setuptools import find_packages, setup
setup(
name='Prototype Head Start Pre-Screener',
version='0.0.1',
packages=find_packages(),
include_package_data=True,
zip_safe=False,
install_requires=[
'flask',
'requests',
'python-dotenv',
'Flask-HTTPAuth'
],
)
| [
"setuptools.find_packages"
] | [((132, 147), 'setuptools.find_packages', 'find_packages', ([], {}), '()\n', (145, 147), False, 'from setuptools import find_packages, setup\n')] |
import json
import random
import sys
def print_doc(doc):
for sec in doc['sections']:
if sec['num'] == 'header':
continue
for sen in sec['sens']:
print(f"{sen['sen_id']}\t{sen['text']}")
def sample_ids(ids, n, seed):
sys.stderr.write(f"using random seed {seed}\n")
... | [
"sys.stderr.write",
"random.sample",
"random.seed"
] | [((269, 316), 'sys.stderr.write', 'sys.stderr.write', (['f"""using random seed {seed}\n"""'], {}), "(f'using random seed {seed}\\n')\n", (285, 316), False, 'import sys\n'), ((479, 496), 'random.seed', 'random.seed', (['seed'], {}), '(seed)\n', (490, 496), False, 'import random\n'), ((508, 529), 'random.sample', 'random... |
import networkx as nx
import community
import demon
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import pickle
import random
import re
from collections import Counter
def prune_pages(links, categories):
'''Remove pages dedicated to numbers and identifiers.
Parameters:
dict links:... | [
"pandas.Series",
"networkx.algorithms.community.k_clique_communities",
"networkx.barabasi_albert_graph",
"community.modularity",
"matplotlib.pyplot.savefig",
"re.compile",
"demon.Demon",
"matplotlib.pyplot.title",
"networkx.DiGraph",
"pickle.load",
"community.best_partition",
"collections.Coun... | [((2023, 2102), 're.compile', 're.compile', (['"""[Aa]rticle|[Pp]ages|Wiki|Use \\\\w* dates|Use .*English|[Tt]emplate"""'], {}), "('[Aa]rticle|[Pp]ages|Wiki|Use \\\\w* dates|Use .*English|[Tt]emplate')\n", (2033, 2102), False, 'import re\n'), ((2115, 2149), 're.compile', 're.compile', (['"""\\\\d\\\\d\\\\d\\\\d|century... |
from app import server, db
def create_all():
with server.app_context():
db.create_all()
if __name__ == "__main__":
create_all()
| [
"app.db.create_all",
"app.server.app_context"
] | [((56, 76), 'app.server.app_context', 'server.app_context', ([], {}), '()\n', (74, 76), False, 'from app import server, db\n'), ((86, 101), 'app.db.create_all', 'db.create_all', ([], {}), '()\n', (99, 101), False, 'from app import server, db\n')] |
from django.views import generic
from django.conf import settings
from django.conf.urls import url
from django.contrib import admin
from django.views.decorators.csrf import ensure_csrf_cookie
from tempestatibus.api import views
# Removing first slash as it is unnecessary
urlPrefix = r'^' + settings.API_BASE_PREFIX[1:]... | [
"django.conf.urls.url",
"django.views.generic.TemplateView.as_view",
"tempestatibus.api.views.ConfirmUnsubscriptionView.as_view",
"tempestatibus.api.views.SubscribeReceiptView.as_view",
"tempestatibus.api.views.UnsubscribeReceiptView.as_view",
"tempestatibus.api.views.ConfirmSubscriptionView.as_view",
"... | [((1216, 1248), 'django.conf.urls.url', 'url', (['"""^/admin/"""', 'admin.site.urls'], {}), "('^/admin/', admin.site.urls)\n", (1219, 1248), False, 'from django.conf.urls import url\n'), ((463, 491), 'tempestatibus.api.views.LocationView.as_view', 'views.LocationView.as_view', ([], {}), '()\n', (489, 491), False, 'from... |
#!/usr/bin/env python
import argparse
import requests
import cobra.mit.access
import cobra.mit.session
import cobra.mit.request
import cobra.model.pol
import cobra.model.fv
# use argparse to provide optional arguments and a help menu
cli_args = argparse.ArgumentParser("Create Tenant", "Creates a Tenant in the specifie... | [
"requests.packages.urllib3.disable_warnings",
"argparse.ArgumentParser"
] | [((246, 391), 'argparse.ArgumentParser', 'argparse.ArgumentParser', (['"""Create Tenant"""', '"""Creates a Tenant in the specified ACI fabric."""', '"""Required: Tenant, VRF, Bridge Domain, Subnet"""'], {}), "('Create Tenant',\n 'Creates a Tenant in the specified ACI fabric.',\n 'Required: Tenant, VRF, Bridge Dom... |
from django.urls import path , include
from . import views
urlpatterns = \
[
# added all paths edir and recipe details want to go to specific pages
# so they need id numbers for specific recipes
path('',views.index, name='index'),
path('NewUser/',views.NewUser , name='NewUser'),
... | [
"django.urls.path",
"django.urls.include"
] | [((225, 260), 'django.urls.path', 'path', (['""""""', 'views.index'], {'name': '"""index"""'}), "('', views.index, name='index')\n", (229, 260), False, 'from django.urls import path, include\n'), ((269, 316), 'django.urls.path', 'path', (['"""NewUser/"""', 'views.NewUser'], {'name': '"""NewUser"""'}), "('NewUser/', vie... |
from rest_framework import serializers
class FooModel(object):
pass
class FooSerializer(serializers.Serializer):
class Meta:
model = FooModel
email = serializers.EmailField()
content = serializers.CharField(max_length=200)
created = serializers.DateTimeField()
class FooViewSet(object)... | [
"rest_framework.serializers.DateTimeField",
"rest_framework.serializers.EmailField",
"rest_framework.serializers.CharField"
] | [((175, 199), 'rest_framework.serializers.EmailField', 'serializers.EmailField', ([], {}), '()\n', (197, 199), False, 'from rest_framework import serializers\n'), ((214, 251), 'rest_framework.serializers.CharField', 'serializers.CharField', ([], {'max_length': '(200)'}), '(max_length=200)\n', (235, 251), False, 'from r... |
# a, b, c = map(int, input("Input Values A B C").split())
from lib2to3.pgen2.grammar import line
import math
numList = []
def r1(a, b, c):
return (-b + math.sqrt(math.pow(b, 2) - 4 * a * c)) / 2 * a
def r2(a, b, c):
return (-b + math.sqrt(math.pow(b, 2) - 4 * a * c)) / 2 * a
def disc(a, b, c):
calc =... | [
"math.pow"
] | [((169, 183), 'math.pow', 'math.pow', (['b', '(2)'], {}), '(b, 2)\n', (177, 183), False, 'import math\n'), ((252, 266), 'math.pow', 'math.pow', (['b', '(2)'], {}), '(b, 2)\n', (260, 266), False, 'import math\n')] |
"""
Created on 2018-10-29
@author: <NAME>
<EMAIL>
"""
import copy
import networkx as nx
import torch.nn as nn
import numpy as np
from nord.neural_nets import NeuralDescriptor
from nord.neural_nets.layers import Identity, ScaleLayer
from nord.utils import get_random_value
from .chromosom... | [
"matplotlib.pyplot.show",
"numpy.random.choice",
"networkx.DiGraph",
"networkx.all_simple_paths",
"networkx.simple_cycles",
"ast.literal_eval",
"numpy.argsort",
"nord.utils.get_random_value",
"matplotlib.pyplot.figure",
"copy.deepcopy",
"networkx.draw",
"nord.neural_nets.NeuralDescriptor"
] | [((1577, 1595), 'nord.utils.get_random_value', 'get_random_value', ([], {}), '()\n', (1593, 1595), False, 'from nord.utils import get_random_value\n'), ((3098, 3117), 'copy.deepcopy', 'copy.deepcopy', (['self'], {}), '(self)\n', (3111, 3117), False, 'import copy\n'), ((4370, 4391), 'ast.literal_eval', 'ast.literal_eval... |
# -*- coding: utf-8 -*-
import factory
from accounts.tests.factories import UserFactory
from editor.constants import REGION_CHOICES
from editor.models import Dataset, Format, Category, Source, Extension, DataFile
class CategoryFactory(factory.django.DjangoModelFactory):
class Meta:
model = Category
... | [
"factory.SubFactory",
"factory.Sequence"
] | [((330, 381), 'factory.Sequence', 'factory.Sequence', (["(lambda n: 'Test dataset %03d' % n)"], {}), "(lambda n: 'Test dataset %03d' % n)\n", (346, 381), False, 'import factory\n'), ((492, 542), 'factory.Sequence', 'factory.Sequence', (["(lambda n: 'Test source %03d' % n)"], {}), "(lambda n: 'Test source %03d' % n)\n",... |
# -*- coding: utf-8 -*-
from datetime import date
from entrenamiento.views.form import ModelForm
class GastoForm(ModelForm):
''' Tiene toda la data del form de cuando se esta creando
o editando un :class:`entrenamiento.models.gasto.Gasto`
'''
def __init__(self, model_class, object_id=None):
... | [
"datetime.date"
] | [((577, 645), 'datetime.date', 'date', (['res.mes_correspondiente.year', 'res.mes_correspondiente.month', '(1)'], {}), '(res.mes_correspondiente.year, res.mes_correspondiente.month, 1)\n', (581, 645), False, 'from datetime import date\n')] |
import os
from pathlib import Path
import patoolib
from service.ws_re.download.archive import Archive
from service.ws_re.download.base import DownloadTarget, BASE_PATH
from service.ws_re.download.data import _RAW_FILES
class RawFiles(DownloadTarget):
def __init__(self, target: str):
self.target = target... | [
"service.ws_re.download.archive.Archive",
"service.ws_re.download.base.BASE_PATH.joinpath",
"os.makedirs",
"pathlib.Path"
] | [((706, 748), 'os.makedirs', 'os.makedirs', (['path_raw_files'], {'exist_ok': '(True)'}), '(path_raw_files, exist_ok=True)\n', (717, 748), False, 'import os\n'), ((402, 422), 'service.ws_re.download.archive.Archive', 'Archive', (['self.source'], {}), '(self.source)\n', (409, 422), False, 'from service.ws_re.download.ar... |
import matplotlib.pyplot as plt
# plt.rc('font',family='Times New Roman')
from data_loader import Loader, XT, TS
import numpy as np
xt, ts = XT(), TS()
fontsize_title = 24
fontsize_label = 22
fontsize_tick = 20
fontsize_legend = 18
def default_set(tick=False, legend=False, layout=True):
if tick:
plt.xti... | [
"matplotlib.pyplot.savefig",
"matplotlib.pyplot.xticks",
"matplotlib.pyplot.ylabel",
"matplotlib.pyplot.xlabel",
"data_loader.TS",
"data_loader.XT",
"matplotlib.pyplot.figure",
"matplotlib.pyplot.yticks",
"matplotlib.pyplot.tight_layout",
"matplotlib.pyplot.legend",
"matplotlib.pyplot.show"
] | [((142, 146), 'data_loader.XT', 'XT', ([], {}), '()\n', (144, 146), False, 'from data_loader import Loader, XT, TS\n'), ((148, 152), 'data_loader.TS', 'TS', ([], {}), '()\n', (150, 152), False, 'from data_loader import Loader, XT, TS\n'), ((1064, 1091), 'matplotlib.pyplot.figure', 'plt.figure', ([], {'figsize': '(13, 4... |
# All of Got Issues config values
import os
import logging
# Logging Setup
logging.basicConfig(level=logging.INFO)
# Variables
GOOGLE_ANALYTICS_PROFILE_ID = "41226190"
GOOGLE_SERVICE_ACCOUNT_EMAIL = os.environ["GOOGLE_SERVICE_ACCOUNT_EMAIL"]
GOOGLE_SERVICE_ACCOUNT_SECRET_KEY = os.environ["GOOGLE_SERVICE_ACCOUNT_SECRE... | [
"logging.basicConfig"
] | [((76, 115), 'logging.basicConfig', 'logging.basicConfig', ([], {'level': 'logging.INFO'}), '(level=logging.INFO)\n', (95, 115), False, 'import logging\n')] |
# -*- coding: utf-8 -*-
from datetime import timedelta
from django.conf import settings
from django.contrib.auth.models import User
from django.db import models
from django.db.models.signals import post_save
from django.dispatch import receiver
from django.utils import timezone
from rest_framework.authtoken.models i... | [
"django.db.models.OneToOneField",
"django.db.models.TextField",
"django.db.models.IntegerField",
"django.db.models.DateTimeField",
"django.db.models.BooleanField",
"django.utils.timezone.now",
"django.dispatch.receiver",
"datetime.timedelta",
"django.db.models.CharField",
"rest_framework.authtoken... | [((353, 405), 'django.dispatch.receiver', 'receiver', (['post_save'], {'sender': 'settings.AUTH_USER_MODEL'}), '(post_save, sender=settings.AUTH_USER_MODEL)\n', (361, 405), False, 'from django.dispatch import receiver\n'), ((824, 868), 'django.db.models.OneToOneField', 'models.OneToOneField', (['User'], {'primary_key':... |
from sklearn import preprocessing
from sklearn.linear_model import LogisticRegression
#from sklearn.cross_validation import train_test_split
from sklearn import metrics
from sklearn.metrics import classification_report
from sklearn.preprocessing import StandardScaler
from sklearn.metrics import accuracy_score
from skl... | [
"sklearn.preprocessing.StandardScaler",
"sklearn.svm.SVC",
"sklearn.linear_model.LogisticRegression"
] | [((408, 428), 'sklearn.linear_model.LogisticRegression', 'LogisticRegression', ([], {}), '()\n', (426, 428), False, 'from sklearn.linear_model import LogisticRegression\n'), ((436, 452), 'sklearn.preprocessing.StandardScaler', 'StandardScaler', ([], {}), '()\n', (450, 452), False, 'from sklearn.preprocessing import Sta... |
import json
import os
import shutil
import urlparse
from django.conf import settings
from django.core.cache import cache
from django.utils.encoding import iri_to_uri
from django.utils.http import http_date, urlencode
from mock import Mock, patch
from nose.tools import eq_
from pyquery import PyQuery as pq
import waff... | [
"files.helpers.DiffHelper",
"nose.tools.eq_",
"mock.Mock",
"django.utils.http.urlencode",
"files.helpers.FileViewer",
"pyquery.PyQuery",
"urlparse.urlparse",
"os.path.exists",
"mock.patch",
"users.models.UserProfile.objects.get",
"market.models.AddonPurchase.objects.create",
"json.loads",
"a... | [((16833, 16889), 'mock.patch.object', 'patch.object', (['waffle', '"""switch_is_active"""', '(lambda x: True)'], {}), "(waffle, 'switch_is_active', lambda x: True)\n", (16845, 16889), False, 'from mock import Mock, patch\n'), ((6750, 6782), 'mock.patch', 'patch', (['"""waffle.switch_is_active"""'], {}), "('waffle.swit... |
# -*- coding: utf-8 -*-
# Generated by Django 1.10 on 2016-08-03 19:57
from __future__ import unicode_literals
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('quiz', '0001_initial'),
... | [
"django.db.models.TextField",
"django.db.models.ForeignKey",
"django.db.models.IntegerField",
"django.db.models.BooleanField",
"django.db.migrations.AlterModelOptions",
"django.db.migrations.RemoveField",
"django.db.models.CharField"
] | [((350, 465), 'django.db.migrations.AlterModelOptions', 'migrations.AlterModelOptions', ([], {'name': '"""choice"""', 'options': "{'verbose_name': 'Ответ', 'verbose_name_plural': 'Ответы'}"}), "(name='choice', options={'verbose_name':\n 'Ответ', 'verbose_name_plural': 'Ответы'})\n", (378, 465), False, 'from django.d... |
# --------------
# Code starts here
import numpy as np
# Code starts here
# Adjacency matrix
adj_mat = np.array([[0,0,0,0,0,0,1/3,0],
[1/2,0,1/2,1/3,0,0,0,0],
[1/2,0,0,0,0,0,0,0],
[0,1,0,0,0,0,0,0],
[0,0,1/2,1/3,0,0,1/3,0],
... | [
"numpy.ones",
"numpy.linalg.eig",
"numpy.max",
"numpy.array",
"numpy.dot",
"numpy.linalg.norm"
] | [((106, 397), 'numpy.array', 'np.array', (['[[0, 0, 0, 0, 0, 0, 1 / 3, 0], [1 / 2, 0, 1 / 2, 1 / 3, 0, 0, 0, 0], [1 / 2,\n 0, 0, 0, 0, 0, 0, 0], [0, 1, 0, 0, 0, 0, 0, 0], [0, 0, 1 / 2, 1 / 3, 0,\n 0, 1 / 3, 0], [0, 0, 0, 1 / 3, 1 / 3, 0, 0, 1 / 2], [0, 0, 0, 0, 1 / 3,\n 0, 0, 1 / 2], [0, 0, 0, 0, 1 / 3, 1, 1 /... |
import numpy as np
from ..base import Parameter
from .optimizer import BaseOptimizer
from benderopt.utils import logb
from .random import RandomOptimizer
class ParzenEstimator(BaseOptimizer):
""" Parzen Estimator
This estimator is largely inspired from TPE and hyperopt.
https://papers.nips.cc/paper/4443-... | [
"numpy.clip",
"benderopt.utils.logb",
"numpy.random.choice",
"numpy.argsort",
"numpy.array",
"numpy.concatenate",
"numpy.maximum"
] | [((4961, 5010), 'numpy.array', 'np.array', (["parameter.search_space['probabilities']"], {}), "(parameter.search_space['probabilities'])\n", (4969, 5010), True, 'import numpy as np\n'), ((6366, 6390), 'numpy.argsort', 'np.argsort', (['unsorted_mus'], {}), '(unsorted_mus)\n', (6376, 6390), True, 'import numpy as np\n'),... |
import pymysql
from config import getMysqlConnection
def nettoyerInstantanne(date):
dateStr = date.strftime("%Y-%m-%d %H:%M:%S")
mysql = getMysqlConnection()
requete = mysql.cursor()
requete.execute('DELETE FROM status WHERE idConso IN ( \
SELECT id FROM statusConso \
WHERE date < "'+dateStr+'"... | [
"config.getMysqlConnection"
] | [((146, 166), 'config.getMysqlConnection', 'getMysqlConnection', ([], {}), '()\n', (164, 166), False, 'from config import getMysqlConnection\n'), ((522, 542), 'config.getMysqlConnection', 'getMysqlConnection', ([], {}), '()\n', (540, 542), False, 'from config import getMysqlConnection\n'), ((817, 837), 'config.getMysql... |
"""
Utils specific to GPT2 network.
"""
# torch
import torch
# TRT-HuggingFace
from NNDF.general_utils import measure_python_inference_code
from NNDF.torch_utils import use_cuda
@use_cuda
def gpt2_inference(gpt2, input_ids, timing_profile, use_cuda=True):
gpt2_stmt = lambda: gpt2(input_ids=input_ids)
gpt2_e... | [
"NNDF.general_utils.measure_python_inference_code"
] | [((337, 449), 'NNDF.general_utils.measure_python_inference_code', 'measure_python_inference_code', (['gpt2_stmt'], {'number': 'timing_profile.number', 'iterations': 'timing_profile.iterations'}), '(gpt2_stmt, number=timing_profile.number,\n iterations=timing_profile.iterations)\n', (366, 449), False, 'from NNDF.gene... |
from click import secho
from typer import Typer
from config_helpers import save_config
from credentials_helper import set_password, delete_password
from tcli.typer_app import TyperApp
class CredentialsApp(TyperApp):
def on_create_app(self, app: Typer, *args, **kwargs) -> Typer:
@app.command()
def... | [
"credentials_helper.delete_password",
"credentials_helper.set_password",
"config_helpers.save_config",
"click.secho"
] | [((441, 474), 'credentials_helper.set_password', 'set_password', (['user_name', 'password'], {}), '(user_name, password)\n', (453, 474), False, 'from credentials_helper import set_password, delete_password\n'), ((532, 556), 'config_helpers.save_config', 'save_config', (['self.config'], {}), '(self.config)\n', (543, 556... |
# SPDX-License-Identifier: MIT
import json
import re
import click
import requests
VECTORS = {
"NETWORK": "Remote",
"ADJACENT_NETWORK": "Remote",
"LOCAL": "Local",
"PHYSICAL": "Local",
}
@click.command()
@click.argument("cve", nargs=-1)
@click.option(
"--output",
type=click.File("w"),
de... | [
"click.argument",
"json.loads",
"json.dumps",
"click.File",
"re.match",
"requests.get",
"click.echo",
"click.command",
"click.get_text_stream"
] | [((208, 223), 'click.command', 'click.command', ([], {}), '()\n', (221, 223), False, 'import click\n'), ((225, 256), 'click.argument', 'click.argument', (['"""cve"""'], {'nargs': '(-1)'}), "('cve', nargs=-1)\n", (239, 256), False, 'import click\n'), ((757, 783), 'requests.get', 'requests.get', (['api_endpoint'], {}), '... |
"""lake_utils.py"""
import matplotlib.pyplot as plt
import pandas as pd
import seaborn as sns
sns.set_style("darkgrid")
def merge_data():
"""
I need to be able to export this table so I can share the .csv
with my advisor.
"""
flux = pd.read_csv('~/Dropbox/CSE599/Kuhn/HW5/data/flux.csv')
che... | [
"matplotlib.pyplot.savefig",
"pandas.read_csv",
"seaborn.set_style",
"matplotlib.pyplot.scatter",
"pandas.concat"
] | [((97, 122), 'seaborn.set_style', 'sns.set_style', (['"""darkgrid"""'], {}), "('darkgrid')\n", (110, 122), True, 'import seaborn as sns\n'), ((258, 312), 'pandas.read_csv', 'pd.read_csv', (['"""~/Dropbox/CSE599/Kuhn/HW5/data/flux.csv"""'], {}), "('~/Dropbox/CSE599/Kuhn/HW5/data/flux.csv')\n", (269, 312), True, 'import ... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import locale
import sys
from os import path
directory, file = path.split(__file__)
directory = path.expanduser(directory)
directory = path.abspath(directory)
sys.path.append(directory)
# warn if the user has different encoding than utf-8
encoding = locale.ge... | [
"locale.getpreferredencoding",
"os.path.split",
"os.path.abspath",
"sys.path.append",
"os.path.expanduser"
] | [((110, 130), 'os.path.split', 'path.split', (['__file__'], {}), '(__file__)\n', (120, 130), False, 'from os import path\n'), ((149, 175), 'os.path.expanduser', 'path.expanduser', (['directory'], {}), '(directory)\n', (164, 175), False, 'from os import path\n'), ((194, 217), 'os.path.abspath', 'path.abspath', (['direct... |
# Equipe Machine big deep data learning vovozinha science
from ple.games.catcher import Catcher
from ple import PLE
import numpy as np
import random
exploration_rate = 0.1
gamma = 0.9
alpha = 0.6
class RandomAgent:
def __init__(self, actions):
self.actions = actions
self.q_table = np.empty((301, 301, 3)) #(play... | [
"random.uniform",
"random.choice",
"random.randrange",
"ple.PLE",
"numpy.empty",
"ple.games.catcher.Catcher"
] | [((2107, 2152), 'ple.games.catcher.Catcher', 'Catcher', ([], {'width': '(256)', 'height': '(256)', 'init_lives': '(10)'}), '(width=256, height=256, init_lives=10)\n', (2114, 2152), False, 'from ple.games.catcher import Catcher\n'), ((2158, 2213), 'ple.PLE', 'PLE', (['game'], {'fps': '(30)', 'display_screen': '(True)', ... |
from urlparse import urlparse, uses_netloc
# workaround for http://bugs.python.org/issue7904
if urlparse('s3://bucket/key').netloc != 'bucket':
uses_netloc.append('s3')
| [
"urlparse.urlparse",
"urlparse.uses_netloc.append"
] | [((149, 173), 'urlparse.uses_netloc.append', 'uses_netloc.append', (['"""s3"""'], {}), "('s3')\n", (167, 173), False, 'from urlparse import urlparse, uses_netloc\n'), ((97, 124), 'urlparse.urlparse', 'urlparse', (['"""s3://bucket/key"""'], {}), "('s3://bucket/key')\n", (105, 124), False, 'from urlparse import urlparse,... |
# Copyright (c) 2015 Mirantis, Inc.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless requir... | [
"refstack.api.utils.check_user_is_vendor_admin",
"refstack.db.get_test_result_records",
"refstack.api.utils.check_owner",
"refstack.db.get_pubkey",
"six.moves.urllib.parse.urljoin",
"refstack.db.get_test_result_records_count",
"refstack.db.get_product_version_by_cpid",
"oslo_log.log.getLogger",
"ref... | [((1012, 1035), 'oslo_log.log.getLogger', 'log.getLogger', (['__name__'], {}), '(__name__)\n', (1025, 1035), False, 'from oslo_log import log\n'), ((1561, 1581), 'pecan.expose', 'pecan.expose', (['"""json"""'], {}), "('json')\n", (1573, 1581), False, 'import pecan\n'), ((2025, 2045), 'pecan.expose', 'pecan.expose', (['... |
import numpy as np
def rgb2yuv(r, g, b, mode="ycbcr"):
# 8 bit full scale Y Cb Cr
Y = [0.299, 0.587, 0.114]
U = [-0.169, -0.331, 0.5]
V = [0.5, -0.419, -0.081]
yuv = np.asarray([Y, U, V])
if mode == "ycbcr":
return yuv.dot(np.asarray([r, g, b]))
elif mode == "yuv":
return ... | [
"numpy.array",
"numpy.asarray"
] | [((188, 209), 'numpy.asarray', 'np.asarray', (['[Y, U, V]'], {}), '([Y, U, V])\n', (198, 209), True, 'import numpy as np\n'), ((527, 548), 'numpy.asarray', 'np.asarray', (['[r, g, b]'], {}), '([r, g, b])\n', (537, 548), True, 'import numpy as np\n'), ((568, 591), 'numpy.asarray', 'np.asarray', (['[[y, u, v]]'], {}), '(... |
#encoding: utf-8
import scrapy
from scrapy.contrib.linkextractors import LinkExtractor
from scrapy.contrib.spiders import CrawlSpider, Rule
from misc.store import doubanDB
from parsers import *
class AlbumSpider(CrawlSpider):
name = "album"
allowed_domains = ["www.douban.com"]
start_urls = [
"http... | [
"misc.store.doubanDB.album.update",
"misc.store.doubanDB.album.find_one",
"misc.store.doubanDB.album.save",
"scrapy.contrib.linkextractors.LinkExtractor"
] | [((1239, 1295), 'misc.store.doubanDB.album.update', 'doubanDB.album.update', (['spec', "{'$set': item}"], {'upsert': '(True)'}), "(spec, {'$set': item}, upsert=True)\n", (1260, 1295), False, 'from misc.store import doubanDB\n'), ((1469, 1536), 'misc.store.doubanDB.album.find_one', 'doubanDB.album.find_one', (["{'from_u... |
from django.contrib import admin
from .models import User, UserOutreach, UserStatus, Logging
admin.site.register(UserStatus)
admin.site.register(UserOutreach)
@admin.register(User)
class UserAdmin(admin.ModelAdmin):
list_display = ('username', 'question_id', 'points', 'xp')
search_fields = ('email', 'userna... | [
"django.contrib.admin.site.register",
"django.contrib.admin.register"
] | [((95, 126), 'django.contrib.admin.site.register', 'admin.site.register', (['UserStatus'], {}), '(UserStatus)\n', (114, 126), False, 'from django.contrib import admin\n'), ((127, 160), 'django.contrib.admin.site.register', 'admin.site.register', (['UserOutreach'], {}), '(UserOutreach)\n', (146, 160), False, 'from djang... |
import codecs
from os import path
from ncbi_genome_download.summary import SummaryReader
def open_testfile(fname):
return codecs.open(path.join(path.dirname(__file__), fname), 'r', 'utf-8')
def test_bacteria_ascii():
ascii_file = open_testfile('partial_summary.txt')
reader = SummaryReader(ascii_file)
... | [
"os.path.dirname",
"ncbi_genome_download.summary.SummaryReader"
] | [((293, 318), 'ncbi_genome_download.summary.SummaryReader', 'SummaryReader', (['ascii_file'], {}), '(ascii_file)\n', (306, 318), False, 'from ncbi_genome_download.summary import SummaryReader\n'), ((513, 537), 'ncbi_genome_download.summary.SummaryReader', 'SummaryReader', (['utf8_file'], {}), '(utf8_file)\n', (526, 537... |
#! /usr/bin/env python
# -*- coding: utf-8 -*-
__author__ = 'maxim'
import functools
from tensorflow.python.client import device_lib
def graph_vars(graph):
for n in graph.as_graph_def().node:
element = graph.as_graph_element(n.name)
if element.type == 'Variable' or element.type == 'VariableV2':
yield... | [
"functools.reduce",
"tensorflow.python.client.device_lib.list_local_devices"
] | [((447, 514), 'functools.reduce', 'functools.reduce', (['(lambda x, y: x * y)', '[dim.size for dim in dims]', '(1)'], {}), '(lambda x, y: x * y, [dim.size for dim in dims], 1)\n', (463, 514), False, 'import functools\n'), ((558, 589), 'tensorflow.python.client.device_lib.list_local_devices', 'device_lib.list_local_devi... |
from django.db import models
from django.contrib.auth.models import User
import os
import uuid
# Create your models here.
class Estado(models.Model):
id = models.UUIDField(primary_key=True, default=uuid.uuid4, editable=False)
clave = models.CharField(max_length=10)
nombre = models.CharField(max_length=10... | [
"django.db.models.ForeignKey",
"django.db.models.IntegerField",
"os.path.join",
"django.db.models.DateTimeField",
"django.db.models.CharField",
"django.db.models.ImageField",
"django.db.models.UUIDField"
] | [((162, 232), 'django.db.models.UUIDField', 'models.UUIDField', ([], {'primary_key': '(True)', 'default': 'uuid.uuid4', 'editable': '(False)'}), '(primary_key=True, default=uuid.uuid4, editable=False)\n', (178, 232), False, 'from django.db import models\n'), ((245, 276), 'django.db.models.CharField', 'models.CharField'... |
from django.contrib import admin
from apps.blog.models import Post, Tag, Comment
from apps.blog.utils.admin import release_posts
@admin.register(Post)
class PostAdmin(admin.ModelAdmin):
list_display = ('title', 'released', 'created_at', 'released_at')
fields = ('title', 'slug', 'content', 'tags')
prepopu... | [
"django.contrib.admin.register",
"django.contrib.admin.site.register"
] | [((132, 152), 'django.contrib.admin.register', 'admin.register', (['Post'], {}), '(Post)\n', (146, 152), False, 'from django.contrib import admin\n'), ((485, 504), 'django.contrib.admin.register', 'admin.register', (['Tag'], {}), '(Tag)\n', (499, 504), False, 'from django.contrib import admin\n'), ((626, 654), 'django.... |
from audiovisuaali import send
from requests import get as rget
from json import loads
# Joke
async def dad_joke(message, client, arguments):
# Starting to fetch a joke
response = loads(rget("https://icanhazdadjoke.com/slack").text)
# Creating letter
letter = "<@{}> **| {}**".format(message.... | [
"requests.get",
"audiovisuaali.send"
] | [((451, 475), 'audiovisuaali.send', 'send', (['(1)', '"""Dad joke sent"""'], {}), "(1, 'Dad joke sent')\n", (455, 475), False, 'from audiovisuaali import send\n'), ((204, 244), 'requests.get', 'rget', (['"""https://icanhazdadjoke.com/slack"""'], {}), "('https://icanhazdadjoke.com/slack')\n", (208, 244), True, 'from req... |
from django.urls import path, re_path
from . import views
APP_NAME = "comment"
urlpatterns = [
path("post/<int:article_id>/", views.post_comment, name="post_comment"),
re_path("delete/(\d+)/(\d+)/", views.delete_comment, name="delete_comment"),
] | [
"django.urls.re_path",
"django.urls.path"
] | [((101, 172), 'django.urls.path', 'path', (['"""post/<int:article_id>/"""', 'views.post_comment'], {'name': '"""post_comment"""'}), "('post/<int:article_id>/', views.post_comment, name='post_comment')\n", (105, 172), False, 'from django.urls import path, re_path\n'), ((178, 255), 'django.urls.re_path', 're_path', (['""... |
## writed by <NAME> 2022-05-05
__all__ = ["filter_nan"]
import numpy as np
def filter_nan(sim, obs):
count = len(obs) - np.isnan(obs).sum()
s1 = np.empty(count)
o1 = np.empty(count)
k=0
for i in range(len(obs)):
if np.isnan(obs[i]):
continue
else:
o1[k] =... | [
"numpy.empty",
"numpy.isnan"
] | [((158, 173), 'numpy.empty', 'np.empty', (['count'], {}), '(count)\n', (166, 173), True, 'import numpy as np\n'), ((183, 198), 'numpy.empty', 'np.empty', (['count'], {}), '(count)\n', (191, 198), True, 'import numpy as np\n'), ((248, 264), 'numpy.isnan', 'np.isnan', (['obs[i]'], {}), '(obs[i])\n', (256, 264), True, 'im... |
# I managed to get this working by changing the code for adapter a little bit.
#
# adapter.py
from allauth.socialaccount.adapter import DefaultSocialAccountAdapter
from users.models import User
from allauth.account.models import EmailAddress
class MySocialAccountAdapter(DefaultSocialAccountAdapter):
def pre_soci... | [
"users.models.User.objects.get",
"allauth.account.models.EmailAddress.objects.get"
] | [((1855, 1889), 'users.models.User.objects.get', 'User.objects.get', ([], {'email': 'user.email'}), '(email=user.email)\n', (1871, 1889), False, 'from users.models import User\n'), ((1282, 1348), 'allauth.account.models.EmailAddress.objects.get', 'EmailAddress.objects.get', ([], {'email__iexact': 'user.email', 'verifie... |
from spacy.matcher import PhraseMatcher
import json
import re
import spacy
nlp1 = spacy.load('en_core_web_lg')
nlp = nlp1
non_continuous_verb = nlp1(
"hate like love prefer want wish appear feel hear see seem smell sound taste deny disagree mean promise satisfy surprisebelieve imagine know mean realize recognize ... | [
"logging.basicConfig",
"re.split",
"spacy.load",
"spacy.matcher.PhraseMatcher",
"re.sub",
"re.findall",
"re.search"
] | [((83, 111), 'spacy.load', 'spacy.load', (['"""en_core_web_lg"""'], {}), "('en_core_web_lg')\n", (93, 111), False, 'import spacy\n'), ((39558, 39597), 'logging.basicConfig', 'logging.basicConfig', ([], {'level': 'logging.INFO'}), '(level=logging.INFO)\n', (39577, 39597), False, 'import logging\n'), ((13338, 13362), 'sp... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
manage
~~~~~~
Open Schools Kenya management script
Usage:
build everything: ./manage.py build all
build templates: ./manage.py build html
build statics: ./manage.py build static [type] [--no-filters]
... | [
"os.path.exists",
"os.listdir",
"flask_frozen.Freezer",
"os.makedirs",
"re.compile",
"shutil.ignore_patterns",
"os.path.join",
"os.path.splitext",
"shutil.copytree",
"shutil.copyfile",
"shutil.copy",
"shutil.rmtree",
"json.load",
"hashlib.sha1",
"os.walk",
"re.search"
] | [((2398, 2441), 'flask_frozen.Freezer', 'Freezer', (['views.app'], {'with_static_files': '(False)'}), '(views.app, with_static_files=False)\n', (2405, 2441), False, 'from flask_frozen import Freezer\n'), ((3154, 3183), 'os.path.join', 'os.path.join', (['"""build"""', 'prefix'], {}), "('build', prefix)\n", (3166, 3183),... |
import re
from header import Header
from copy import deepcopy
from coordinates import Coordinates
from parameters import Parameters
from zmatrix import ZMatrix
class GaussianInput:
def __init__(self, input_string=None, header=None, coordinates=None, parameters=None):
self.header = []
self.coordina... | [
"header.Header",
"parameters.Parameters",
"re.compile",
"copy.deepcopy",
"re.search"
] | [((1482, 1512), 're.compile', 're.compile', (['"""^(.+\n)+\n(.+\n)"""'], {}), "('^(.+\\n)+\\n(.+\\n)')\n", (1492, 1512), False, 'import re\n'), ((1525, 1557), 're.search', 're.search', (['p_header', 'file_string'], {}), '(p_header, file_string)\n', (1534, 1557), False, 'import re\n'), ((1790, 1846), 're.compile', 're.c... |
"""
Module for auxiliary type detection functions
"""
from enum import Enum, auto
from typing import Any
import numpy as np
import pandas as pd
CATEGORICAL_NUMPY_DTYPES = [np.bool, np.object]
CATEGORICAL_PANDAS_DTYPES = [pd.CategoricalDtype, pd.PeriodDtype]
CATEGORICAL_DTYPES = CATEGORICAL_NUMPY_DTYPES + CATEGORICAL... | [
"enum.auto"
] | [((653, 659), 'enum.auto', 'auto', ([], {}), '()\n', (657, 659), False, 'from enum import Enum, auto\n'), ((676, 682), 'enum.auto', 'auto', ([], {}), '()\n', (680, 682), False, 'from enum import Enum, auto\n')] |
#!/usr/bin/env python3
import sys
from core.cpu_stat_collector import CpuStatCollector
if __name__ == '__main__':
collector = CpuStatCollector(sys.argv[1])
collector.run()
collector.print_result()
| [
"core.cpu_stat_collector.CpuStatCollector"
] | [((131, 160), 'core.cpu_stat_collector.CpuStatCollector', 'CpuStatCollector', (['sys.argv[1]'], {}), '(sys.argv[1])\n', (147, 160), False, 'from core.cpu_stat_collector import CpuStatCollector\n')] |
import numpy as np
import nibabel as nib
import copy
from eisen.transforms.imaging import CreateConstantFlags
from eisen.transforms.imaging import RenameFields
from eisen.transforms.imaging import FilterFields
from eisen.transforms.imaging import ResampleNiftiVolumes
from eisen.transforms.imaging import NiftiToNumpy
f... | [
"numpy.eye",
"eisen.transforms.imaging.ResampleNiftiVolumes",
"numpy.random.rand",
"eisen.transforms.imaging.NiftiToNumpy",
"numpy.ones",
"numpy.arange",
"eisen.transforms.imaging.NumpyToNifti",
"numpy.asanyarray",
"numpy.max",
"numpy.array_equal",
"eisen.transforms.imaging.CropCenteredSubVolume... | [((665, 718), 'eisen.transforms.imaging.CreateConstantFlags', 'CreateConstantFlags', (["['flag1', 'flag2']", '[32.2, 42.0]'], {}), "(['flag1', 'flag2'], [32.2, 42.0])\n", (684, 718), False, 'from eisen.transforms.imaging import CreateConstantFlags\n'), ((744, 814), 'eisen.transforms.imaging.CreateConstantFlags', 'Creat... |
import time
import logging
import PIL.Image
import PIL.ImageGrab
from PIL.Image import Image
from pywinauto.application import Application, AppNotConnected
from pywinauto.findwindows import ElementNotFoundError
from pywinauto.timings import TimeoutError
from pywinauto import mouse, keyboard
from screen_reader import ... | [
"screen_reader.ScreenReader",
"pywinauto.mouse.move",
"pywinauto.mouse.scroll",
"time.sleep",
"pywinauto.keyboard.send_keys",
"pywinauto.application.Application",
"pywinauto.mouse.click",
"logging.info",
"logging.error"
] | [((932, 946), 'screen_reader.ScreenReader', 'ScreenReader', ([], {}), '()\n', (944, 946), False, 'from screen_reader import ScreenReader\n'), ((3803, 3828), 'pywinauto.mouse.move', 'mouse.move', ([], {'coords': 'coords'}), '(coords=coords)\n', (3813, 3828), False, 'from pywinauto import mouse, keyboard\n'), ((3837, 386... |
import argparse
import datetime
from em340.em340 import Em340
from em340.measurement import Measurement
from helper.scheduler import PeriodicScheduler
from helper.csvhelper import CsvHelper
# Settings and default values
port = 'COM4' # serial port
interval = 1 # in seconds
filename_out = 'samples.csv'
debug_mode = Fal... | [
"em340.em340.Em340",
"helper.csvhelper.CsvHelper",
"argparse.ArgumentParser",
"helper.scheduler.PeriodicScheduler"
] | [((332, 357), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (355, 357), False, 'import argparse\n'), ((912, 923), 'em340.em340.Em340', 'Em340', (['port'], {}), '(port)\n', (917, 923), False, 'from em340.em340 import Em340\n'), ((936, 947), 'helper.csvhelper.CsvHelper', 'CsvHelper', ([], {}), '... |
#!/usr/bin/python3
"""
Use this script to prepare the postgresql service for its upcoming tasks.
"""
from sqlalchemy.schema import CreateSchema
from sqlalchemy_utils import create_database, database_exists
from garden.config.target import SCHEMA
from garden.database.base import Base, Engine
if __name__ == "__main__... | [
"sqlalchemy_utils.database_exists",
"sqlalchemy_utils.create_database",
"garden.database.base.Engine.dialect.has_schema",
"garden.database.base.Base.metadata.create_all",
"sqlalchemy.schema.CreateSchema"
] | [((504, 536), 'garden.database.base.Base.metadata.create_all', 'Base.metadata.create_all', (['Engine'], {}), '(Engine)\n', (528, 536), False, 'from garden.database.base import Base, Engine\n'), ((334, 361), 'sqlalchemy_utils.database_exists', 'database_exists', (['Engine.url'], {}), '(Engine.url)\n', (349, 361), False,... |
"""
A theano / pylearn2 wrapper for cuda-convnet's convFilterActs function.
"""
__authors__ = "<NAME>"
__copyright__ = "Copyright 2010-2012, Universite de Montreal"
__credits__ = ["<NAME>", "<NAME>"]
__license__ = "3-clause BSD"
__maintainer__ = "LISA Lab"
__email__ = "<EMAIL>"
"""
This module may contain code copied ... | [
"pylearn2.sandbox.cuda_convnet.base_acts.UnimplementedError",
"theano.sandbox.cuda.basic_ops.gpu_contiguous",
"pylearn2.sandbox.cuda_convnet.img_acts.ImageActs",
"theano.gof.Apply",
"theano.sandbox.cuda.CudaNdarrayType",
"pylearn2.sandbox.cuda_convnet.weight_acts.WeightActs"
] | [((4981, 5033), 'theano.sandbox.cuda.CudaNdarrayType', 'CudaNdarrayType', ([], {'broadcastable': 'targets_broadcastable'}), '(broadcastable=targets_broadcastable)\n', (4996, 5033), False, 'from theano.sandbox.cuda import CudaNdarrayType\n'), ((5083, 5124), 'theano.gof.Apply', 'Apply', (['self', '[images, filters]', '[t... |
import parser
import sys
from typing import List
from compiler_components.compiler_component import CompilerComponent
from compiler_components.lexer import Lexer
from compiler_components.cool_parser import Parser
from compiler_components.semantic_checker import SemanticChecker
from compiler_components.code_generator i... | [
"compiler_components.code_generator.CodeGenerator",
"compiler_components.lexer.Lexer",
"compiler_components.semantic_checker.SemanticChecker",
"compiler_components.cool_parser.Parser"
] | [((432, 451), 'compiler_components.lexer.Lexer', 'Lexer', (['cool_program'], {}), '(cool_program)\n', (437, 451), False, 'from compiler_components.lexer import Lexer\n'), ((470, 483), 'compiler_components.cool_parser.Parser', 'Parser', (['lexer'], {}), '(lexer)\n', (476, 483), False, 'from compiler_components.cool_pars... |
import re
import tiles
# REGEXs for global/clock signals
# Globals including spine inputs, TAP_DRIVE inputs and TAP_DRIVE outputs
global_spine_tap_re = re.compile(r'R\d+C\d+_[HV]P[TLBR]X(\d){2}00')
# CMUX outputs
global_cmux_out_re = re.compile(r'R\d+C\d+_[UL][LR]PCLK\d+')
# CMUX inputs
global_cmux_in_re = re.compile... | [
"re.compile"
] | [((154, 201), 're.compile', 're.compile', (['"""R\\\\d+C\\\\d+_[HV]P[TLBR]X(\\\\d){2}00"""'], {}), "('R\\\\d+C\\\\d+_[HV]P[TLBR]X(\\\\d){2}00')\n", (164, 201), False, 'import re\n'), ((236, 277), 're.compile', 're.compile', (['"""R\\\\d+C\\\\d+_[UL][LR]PCLK\\\\d+"""'], {}), "('R\\\\d+C\\\\d+_[UL][LR]PCLK\\\\d+')\n", (2... |
import requests
if __name__ == "__main__":
url = "http://python123.io/ws"
pxs = {'http': 'http://user:pass@10.10.10.1:1234',
'https': 'https://10.10.10.1:4321'}
r = requests.request('POST', url, proxies=pxs)
print(r.text)
# console | [
"requests.request"
] | [((191, 233), 'requests.request', 'requests.request', (['"""POST"""', 'url'], {'proxies': 'pxs'}), "('POST', url, proxies=pxs)\n", (207, 233), False, 'import requests\n')] |
"""
Based on https://github.com/nshepperd/gpt-2/blob/finetuning/train.py
"""
import json
from pathlib import Path
import sys
import shutil
from typing import List, Tuple
import fire
import numpy as np
import matplotlib.pyplot as plt
import sentencepiece as spm
import tensorflow as tf
import tqdm
from . import model, ... | [
"fire.Fire",
"matplotlib.pyplot.ylabel",
"sentencepiece.SentencePieceProcessor",
"tensorflow.nn.sparse_softmax_cross_entropy_with_logits",
"sys.exit",
"numpy.mean",
"pathlib.Path",
"matplotlib.pyplot.xlabel",
"matplotlib.pyplot.plot",
"tensorflow.Session",
"tensorflow.placeholder",
"tensorflow... | [((434, 450), 'fire.Fire', 'fire.Fire', (['train'], {}), '(train)\n', (443, 450), False, 'import fire\n'), ((1235, 1263), 'sentencepiece.SentencePieceProcessor', 'spm.SentencePieceProcessor', ([], {}), '()\n', (1261, 1263), True, 'import sentencepiece as spm\n'), ((1313, 1327), 'pathlib.Path', 'Path', (['run_path'], {}... |
import sys
sys.path.append('../MCP23017/')
import busio
import board
import time
import signal
import RPi.GPIO as GPIO
from datetime import datetime
from MCP23017_Nixie import MCP23017_Nixie_DigitController
# GPIO
GPIO.setmode(GPIO.BCM)
GPIO.setup(23, GPIO.OUT, initial=GPIO.HIGH)
# Signal handler
def signal_handler... | [
"signal.signal",
"MCP23017_Nixie.MCP23017_Nixie_DigitController",
"RPi.GPIO.setup",
"busio.I2C",
"time.sleep",
"datetime.datetime.now",
"sys.exit",
"sys.path.append",
"RPi.GPIO.setmode"
] | [((11, 42), 'sys.path.append', 'sys.path.append', (['"""../MCP23017/"""'], {}), "('../MCP23017/')\n", (26, 42), False, 'import sys\n'), ((217, 239), 'RPi.GPIO.setmode', 'GPIO.setmode', (['GPIO.BCM'], {}), '(GPIO.BCM)\n', (229, 239), True, 'import RPi.GPIO as GPIO\n'), ((240, 283), 'RPi.GPIO.setup', 'GPIO.setup', (['(23... |
import json
with open('../clustering/articleSummaryPairsFinal.json') as f:
articles = json.load(f)
dumplist = []
for i in range(10):
dumplist.append(articles)
with open('../clustering/sample.json', 'w+') as f:
json.dump(dumplist, f)
| [
"json.load",
"json.dump"
] | [((90, 102), 'json.load', 'json.load', (['f'], {}), '(f)\n', (99, 102), False, 'import json\n'), ((224, 246), 'json.dump', 'json.dump', (['dumplist', 'f'], {}), '(dumplist, f)\n', (233, 246), False, 'import json\n')] |
import argparse
import os
import os.path
import re
import json
import nltk
def add_arguments(parser):
parser.add_argument("--dataset", help="dataset", required=True)
parser.add_argument("--input_dir", help="input directory", required=True)
parser.add_argument("--output_dir", help="output directory", requir... | [
"os.path.exists",
"re.split",
"os.listdir",
"nltk.word_tokenize",
"argparse.ArgumentParser",
"os.path.join",
"os.path.splitext",
"os.path.isfile",
"nltk.sent_tokenize",
"os.mkdir"
] | [((1330, 1354), 'nltk.sent_tokenize', 'nltk.sent_tokenize', (['text'], {}), '(text)\n', (1348, 1354), False, 'import nltk\n'), ((2096, 2117), 'os.listdir', 'os.listdir', (['input_dir'], {}), '(input_dir)\n', (2106, 2117), False, 'import os\n'), ((3528, 3549), 'os.listdir', 'os.listdir', (['input_dir'], {}), '(input_dir... |
from django.urls import path
from core import views
urlpatterns = [
path('', views.Homepage.as_view(), name='homepage'),
path('users/', views.UsersList.as_view(), name='users_list'),
path('user/<slug:username>/', views.user_profile_view, name='user_profile'),
path('search/', views.search_bar, name='sea... | [
"core.views.Homepage.as_view",
"django.urls.path",
"core.views.UsersList.as_view"
] | [((196, 271), 'django.urls.path', 'path', (['"""user/<slug:username>/"""', 'views.user_profile_view'], {'name': '"""user_profile"""'}), "('user/<slug:username>/', views.user_profile_view, name='user_profile')\n", (200, 271), False, 'from django.urls import path\n'), ((277, 329), 'django.urls.path', 'path', (['"""search... |
import logging
import pathlib
import kfp
# loggingの設定
from builtins import str
import kfp
from kfp import dsl
logging.basicConfig(level=logging.DEBUG)
logger = logging.getLogger(__name__)
# componentの設定ファイルまでのパス
file_path = pathlib.Path(__file__).resolve().parents[1]
component_root_url = file_path.joinpath("compone... | [
"logging.basicConfig",
"logging.getLogger",
"pathlib.Path",
"kfp.dsl.pipeline",
"kfp.compiler.Compiler",
"kfp.dsl.ContainerOp",
"kfp.components.load_component_from_file"
] | [((113, 153), 'logging.basicConfig', 'logging.basicConfig', ([], {'level': 'logging.DEBUG'}), '(level=logging.DEBUG)\n', (132, 153), False, 'import logging\n'), ((163, 190), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (180, 190), False, 'import logging\n'), ((706, 773), 'kfp.components... |
# coding: utf8
import collections
import argparse
import pprint
import json
from pathlib import Path
from .score import subtaskA, subtaskB, compute_metrics
from .utils import Collection
def evaluate_scenario(submit, gold, scenario):
submit_input = submit / ("output_scenario%i.txt" % scenario)
if not submit... | [
"argparse.ArgumentParser",
"pathlib.Path",
"json.dumps",
"collections.defaultdict",
"pandas.DataFrame"
] | [((1672, 1701), 'collections.defaultdict', 'collections.defaultdict', (['list'], {}), '(list)\n', (1695, 1701), False, 'import collections\n'), ((4393, 4428), 'argparse.ArgumentParser', 'argparse.ArgumentParser', (['"""evaltest"""'], {}), "('evaltest')\n", (4416, 4428), False, 'import argparse\n'), ((2954, 2973), 'pand... |
#
# Copyright 2020 Google LLC
#
# 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... | [
"google.fhir.utils.annotation_utils.get_fhir_version",
"google.fhir.utils.proto_utils.get_value_at_field_index",
"google.fhir.utils.proto_utils.field_is_set",
"google.fhir._primitive_time_utils.get_date_time_value",
"google.fhir.utils.annotation_utils.is_typed_reference_field",
"google.fhir.utils.annotati... | [((4507, 4554), 'google.fhir.utils.proto_utils.get_value_at_field', 'proto_utils.get_value_at_field', (['period', '"""start"""'], {}), "(period, 'start')\n", (4537, 4554), False, 'from google.fhir.utils import proto_utils\n'), ((4580, 4625), 'google.fhir.utils.proto_utils.get_value_at_field', 'proto_utils.get_value_at_... |
import select
import socket
import re
sock = socket.socket()
sock.bind(('0.0.0.0', 8001))
sock.listen()
sock.setblocking(False)
ep_fd = select.epoll()
ep_fd.register(sock, select.EPOLLIN)
fd_sock = {}
fd_read_data = {}
fd_write_data = {}
tasks = []
def on_read(fd):
# while True:
# try:
# d =... | [
"select.epoll",
"socket.socket"
] | [((46, 61), 'socket.socket', 'socket.socket', ([], {}), '()\n', (59, 61), False, 'import socket\n'), ((137, 151), 'select.epoll', 'select.epoll', ([], {}), '()\n', (149, 151), False, 'import select\n')] |
import re
from datetime import datetime
import time
import urllib
import base64
def command_encode(command):
"""
Encode the command array in a command-string
"""
return "\n".join(_command_encode(command))
def _command_encode(command):
r = []
if type(command) == int:
command = str(command)
if type(command) ... | [
"re.compile",
"urllib.unquote",
"datetime.datetime.strptime",
"base64.b64encode",
"base64.b64decode",
"urllib.quote",
"datetime.datetime.now",
"re.sub"
] | [((734, 787), 're.compile', 're.compile', (['"""^([^\\\\=]*[^\\\\t\\\\= ])[\\\\t ]*=[\\\\t ]*(.*)"""'], {}), "('^([^\\\\=]*[^\\\\t\\\\= ])[\\\\t ]*=[\\\\t ]*(.*)')\n", (744, 787), False, 'import re\n'), ((791, 844), 're.compile', 're.compile', (['"""^property\\\\[([^\\\\]]*)\\\\]"""', 're.IGNORECASE'], {}), "('^propert... |
from django.test import TestCase
from django.urls import reverse
class FilebrowserAnonymousTestCase(TestCase):
def test_browse(self):
url = reverse("fb_browse")
response = self.client.get(url)
self.assertEqual(302, response.status_code)
self.assertEqual("/admin/login/?next=" + url,... | [
"django.urls.reverse"
] | [((154, 174), 'django.urls.reverse', 'reverse', (['"""fb_browse"""'], {}), "('fb_browse')\n", (161, 174), False, 'from django.urls import reverse\n'), ((376, 396), 'django.urls.reverse', 'reverse', (['"""fb_browse"""'], {}), "('fb_browse')\n", (383, 396), False, 'from django.urls import reverse\n'), ((599, 619), 'djang... |
#!"E:\PortableTrac\Portable Python 2.7.3.1\App\python.exe"
# EASY-INSTALL-ENTRY-SCRIPT: 'Pygments==1.5','console_scripts','pygmentize'
__requires__ = 'Pygments==1.5'
import sys
from pkg_resources import load_entry_point
sys.exit(
load_entry_point('Pygments==1.5', 'console_scripts', 'pygmentize')()
)
| [
"pkg_resources.load_entry_point"
] | [((241, 307), 'pkg_resources.load_entry_point', 'load_entry_point', (['"""Pygments==1.5"""', '"""console_scripts"""', '"""pygmentize"""'], {}), "('Pygments==1.5', 'console_scripts', 'pygmentize')\n", (257, 307), False, 'from pkg_resources import load_entry_point\n')] |
from PIL import Image
def open_image(path):
newImage = Image.open(path)
return newImage
# Save Image
def save_image(image, path):
image.save(path, 'png')
# Create a new image with the given size
def create_image(i, j):
image = Image.new("RGB", (i, j), "white")
return image
# Get the pixel from the given i... | [
"PIL.Image.new",
"PIL.Image.open"
] | [((58, 74), 'PIL.Image.open', 'Image.open', (['path'], {}), '(path)\n', (68, 74), False, 'from PIL import Image\n'), ((238, 271), 'PIL.Image.new', 'Image.new', (['"""RGB"""', '(i, j)', '"""white"""'], {}), "('RGB', (i, j), 'white')\n", (247, 271), False, 'from PIL import Image\n')] |
import gin as _gin
from gym.wrappers import AtariPreprocessing as _AtariPreprocessing
from .utils import make_env_fn
_gin.external_configurable(_AtariPreprocessing, denylist=["env"])
| [
"gin.external_configurable"
] | [((119, 184), 'gin.external_configurable', '_gin.external_configurable', (['_AtariPreprocessing'], {'denylist': "['env']"}), "(_AtariPreprocessing, denylist=['env'])\n", (145, 184), True, 'import gin as _gin\n')] |
"""Command models to wait for target temperature of a Temperature Module."""
from __future__ import annotations
from typing import Optional, TYPE_CHECKING
from typing_extensions import Literal, Type
from pydantic import BaseModel, Field
from ..command import AbstractCommandImpl, BaseCommand, BaseCommandCreate
if TYP... | [
"pydantic.Field"
] | [((682, 744), 'pydantic.Field', 'Field', (['...'], {'description': '"""Unique ID of the Temperature Module."""'}), "(..., description='Unique ID of the Temperature Module.')\n", (687, 744), False, 'from pydantic import BaseModel, Field\n')] |
#!/usr/bin/env python
# coding: utf-8
# # Feature Engineering
import matplotlib.pyplot as plt
import numpy as np
import os
import pandas as pd
import re
import seaborn as sns
import statsmodels.api as sm
import sys
from scipy import stats
from scipy.special import boxcox1p, logit
from scipy.stats import norm, skew
fr... | [
"scipy.special.boxcox1p",
"sklearn.preprocessing.PolynomialFeatures",
"seaborn.distplot",
"matplotlib.pyplot.ylabel",
"os.path.join",
"scipy.stats.norm.fit",
"matplotlib.pyplot.close",
"matplotlib.pyplot.figure",
"scipy.special.logit",
"importlib.reload",
"pandas.DataFrame",
"matplotlib.pyplot... | [((505, 528), 'importlib.reload', 'importlib.reload', (['utils'], {}), '(utils)\n', (521, 528), False, 'import importlib\n'), ((544, 568), 'importlib.reload', 'importlib.reload', (['params'], {}), '(params)\n', (560, 568), False, 'import importlib\n'), ((651, 696), 'os.path.join', 'os.path.join', (['""".."""', '"""data... |
from django.http import JsonResponse
import time
def index(request):
return JsonResponse({
'time': time.time()
}) | [
"time.time"
] | [((113, 124), 'time.time', 'time.time', ([], {}), '()\n', (122, 124), False, 'import time\n')] |
import logging
def create_logger(log_file: str, log_level: int, log_stream: bool):
logger = logging.getLogger('dracoon')
formatter = logging.Formatter('%(asctime)s %(name)-12s %(levelname)-8s %(message)s')
if log_stream:
stream_handler = logging.StreamHandler()
stream_handler.setFormatte... | [
"logging.getLogger",
"logging.Formatter",
"logging.StreamHandler",
"logging.FileHandler"
] | [((98, 126), 'logging.getLogger', 'logging.getLogger', (['"""dracoon"""'], {}), "('dracoon')\n", (115, 126), False, 'import logging\n'), ((144, 216), 'logging.Formatter', 'logging.Formatter', (['"""%(asctime)s %(name)-12s %(levelname)-8s %(message)s"""'], {}), "('%(asctime)s %(name)-12s %(levelname)-8s %(message)s')\n"... |
# Conexao de referencia
# IMPORTS {{{
import pygame
import socket
import time
import tkinter as tk
from aux_server import manageInput, manageGameLogic, manageOutput
from global_var import *
from kobra_kombat_game.game import Game
# }}}
def main():# {{{
pygame.init()
clock = pygame.time.Clock() # clock
d... | [
"pygame.init",
"socket.socket",
"aux_server.manageInput",
"aux_server.manageGameLogic",
"aux_server.manageOutput",
"pygame.time.Clock",
"kobra_kombat_game.game.Game",
"time.time"
] | [((260, 273), 'pygame.init', 'pygame.init', ([], {}), '()\n', (271, 273), False, 'import pygame\n'), ((287, 306), 'pygame.time.Clock', 'pygame.time.Clock', ([], {}), '()\n', (304, 306), False, 'import pygame\n'), ((338, 354), 'kobra_kombat_game.game.Game', 'Game', (['SIZE', 'ROWS'], {}), '(SIZE, ROWS)\n', (342, 354), F... |
# Copyright 2015 - Mirantis, 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 ag... | [
"eventlet.semaphore.BoundedSemaphore",
"eventlet.semaphore.Semaphore"
] | [((650, 671), 'eventlet.semaphore.Semaphore', 'semaphore.Semaphore', ([], {}), '()\n', (669, 671), False, 'from eventlet import semaphore\n'), ((810, 839), 'eventlet.semaphore.BoundedSemaphore', 'semaphore.BoundedSemaphore', (['(1)'], {}), '(1)\n', (836, 839), False, 'from eventlet import semaphore\n')] |
from cheez.types import ImageInfo, Namespace
from PIL import Image
import io
def thru_resize(image: ImageInfo, args: Namespace)-> ImageInfo:
pimage = Image.open(io.BytesIO(image.bytes))
size = (args.width, args.height)
pimage.thumbnail(size)
with io.BytesIO() as stream:
pimage.save(stream, for... | [
"io.BytesIO"
] | [((167, 190), 'io.BytesIO', 'io.BytesIO', (['image.bytes'], {}), '(image.bytes)\n', (177, 190), False, 'import io\n'), ((265, 277), 'io.BytesIO', 'io.BytesIO', ([], {}), '()\n', (275, 277), False, 'import io\n')] |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Tue Aug 28 18:50:04 2018
@author: himanshu
"""
import re
from keras.preprocessing.text import text_to_word_sequence
def get_email(line):
email = None
match = re.search(r'[\w\.-]+@[\w\.-]+',line)
if match is not None:
email = match.grou... | [
"keras.preprocessing.text.text_to_word_sequence",
"re.search"
] | [((231, 271), 're.search', 're.search', (['"""[\\\\w\\\\.-]+@[\\\\w\\\\.-]+"""', 'line'], {}), "('[\\\\w\\\\.-]+@[\\\\w\\\\.-]+', line)\n", (240, 271), False, 'import re\n'), ((377, 404), 'keras.preprocessing.text.text_to_word_sequence', 'text_to_word_sequence', (['line'], {}), '(line)\n', (398, 404), False, 'from kera... |
import deepdiff
import mlrun
import mlrun.errors
def test_mount_configmap():
expected_volume = {"configMap": {"name": "my-config-map"}, "name": "my-volume"}
expected_volume_mount = {"mountPath": "/myConfMapPath", "name": "my-volume"}
function = mlrun.new_function(
"function-name", "function-proj... | [
"deepdiff.DeepDiff",
"mlrun.platforms.mount_configmap",
"mlrun.platforms.mount_hostpath",
"mlrun.platforms.mount_s3",
"mlrun.new_function"
] | [((261, 359), 'mlrun.new_function', 'mlrun.new_function', (['"""function-name"""', '"""function-project"""'], {'kind': 'mlrun.runtimes.RuntimeKinds.job'}), "('function-name', 'function-project', kind=mlrun.runtimes\n .RuntimeKinds.job)\n", (279, 359), False, 'import mlrun\n'), ((1124, 1222), 'mlrun.new_function', 'm... |
import numpy as np
import sys
from gaussquad2d import gaussquad1d, gaussquad2d, gaussquad3d
from masternodes import masternodes
from shap import *
sys.path.insert(0, '../util')
sys.path.insert(0, '../mesh')
def mkmaster(mesh, ndim, pgauss=None):
if ndim == 2:
if pgauss == None:
pgauss = mesh[... | [
"gaussquad2d.gaussquad1d",
"sys.path.insert",
"numpy.allclose",
"numpy.linalg.pinv",
"gaussquad2d.gaussquad3d",
"gaussquad2d.gaussquad2d",
"numpy.squeeze",
"import_util.load_mat",
"numpy.diag",
"numpy.concatenate",
"numpy.ravel",
"masternodes.masternodes",
"numpy.set_printoptions"
] | [((148, 177), 'sys.path.insert', 'sys.path.insert', (['(0)', '"""../util"""'], {}), "(0, '../util')\n", (163, 177), False, 'import sys\n'), ((178, 207), 'sys.path.insert', 'sys.path.insert', (['(0)', '"""../mesh"""'], {}), "(0, '../mesh')\n", (193, 207), False, 'import sys\n'), ((3940, 4005), 'numpy.set_printoptions', ... |
# Note on Google Geocoding
import requests
MAPS_API_URL = "https://maps.googleapis.com/maps/api/geocode/json?key=API_KEY"
params = {'address': 'Bengaluru'}
req = requests.get(MAPS_API_URL, params=params).json()
coordinates = req['results'][0]['geometry']['location']
latitude = coordinates['lat']
longitude = coordi... | [
"requests.get"
] | [((165, 206), 'requests.get', 'requests.get', (['MAPS_API_URL'], {'params': 'params'}), '(MAPS_API_URL, params=params)\n', (177, 206), False, 'import requests\n')] |
import numpy as np
import pandas as pd
import random
class DataPreHandle:
# min-max标准化(线性标准化)
@staticmethod
def min_max_normalization(X: pd.DataFrame):
for n in range(X.shape[1]):
X[:, n] = (X[:, n] - np.min(X[:, n])) / (np.max(X[:, n]) - np.min(X[:, n]))
return X
# z-sco... | [
"numpy.max",
"random.randint",
"numpy.min"
] | [((2139, 2163), 'random.randint', 'random.randint', (['(0)', '(i - 1)'], {}), '(0, i - 1)\n', (2153, 2163), False, 'import random\n'), ((236, 251), 'numpy.min', 'np.min', (['X[:, n]'], {}), '(X[:, n])\n', (242, 251), True, 'import numpy as np\n'), ((256, 271), 'numpy.max', 'np.max', (['X[:, n]'], {}), '(X[:, n])\n', (2... |
import os
import logging
from fastapi import Body, Depends
from fastapi.security import HTTPAuthorizationCredentials, HTTPBearer
from keycloak import KeycloakOpenID
from okdata.resource_auth import ResourceAuthorizer
from requests.exceptions import HTTPError
from dataplatform_keycloak.ssm import SsmClient
from models... | [
"logging.getLogger",
"resources.errors.ErrorResponse",
"dataplatform_keycloak.ssm.SsmClient.get_secret",
"resources.resource.resource_type",
"fastapi.security.HTTPBearer",
"os.environ.get",
"models.CreateResourceBody.parse_obj",
"fastapi.Body",
"okdata.resource_auth.ResourceAuthorizer",
"fastapi.D... | [((445, 464), 'logging.getLogger', 'logging.getLogger', ([], {}), '()\n', (462, 464), False, 'import logging\n'), ((1058, 1098), 'fastapi.security.HTTPBearer', 'HTTPBearer', ([], {'scheme_name': '"""Keycloak token"""'}), "(scheme_name='Keycloak token')\n", (1068, 1098), False, 'from fastapi.security import HTTPAuthoriz... |
import pendulum
import uuid
from ..routes import Route
class Auth:
def __init__(self, application, guard_config=None):
self.application = application
self.guards = {}
self._guard = None
self.guard_config = guard_config or {}
self.options = {}
def add_guard(self, name, ... | [
"pendulum.now",
"uuid.uuid4"
] | [((2411, 2423), 'uuid.uuid4', 'uuid.uuid4', ([], {}), '()\n', (2421, 2423), False, 'import uuid\n'), ((3544, 3558), 'pendulum.now', 'pendulum.now', ([], {}), '()\n', (3556, 3558), False, 'import pendulum\n'), ((3243, 3257), 'pendulum.now', 'pendulum.now', ([], {}), '()\n', (3255, 3257), False, 'import pendulum\n')] |
import time
from docx import Document # 引入docx类生成docx文档
from docx.shared import RGBColor
from docx.shared import Pt
from docx.enum.text import WD_ALIGN_PARAGRAPH
from pathlib import Path
__version__ = "1.0.0"
class PrintPreview:
"""本类负责生成完整的口算题文档使之适合打印机打印。可以生成多套题,生成数可以控。
- @p_list list
需要打印口算题库,至少包含一... | [
"docx.shared.Pt",
"docx.shared.RGBColor",
"pathlib.Path",
"time.localtime",
"docx.Document"
] | [((1101, 1114), 'pathlib.Path', 'Path', (['out_put'], {}), '(out_put)\n', (1105, 1114), False, 'from pathlib import Path\n'), ((1563, 1573), 'docx.Document', 'Document', ([], {}), '()\n', (1571, 1573), False, 'from docx import Document\n'), ((1835, 1853), 'docx.shared.RGBColor', 'RGBColor', (['(54)', '(0)', '(0)'], {})... |
from PySide import QtGui
from PySide.QtGui import QDialog
from PySide.QtGui import QHBoxLayout
from PySide.QtGui import QTextEdit
class ConsoleDialog(QtGui.QDialog):
def __init__(self, stream=None):
QtGui.QDialog.__init__(self)
self.stream = stream
self.setWindowTitle('Console Mess... | [
"PySide.QtGui.QHBoxLayout",
"PySide.QtGui.QDialog.__init__",
"PySide.QtGui.QTextEdit"
] | [((212, 240), 'PySide.QtGui.QDialog.__init__', 'QtGui.QDialog.__init__', (['self'], {}), '(self)\n', (234, 240), False, 'from PySide import QtGui\n'), ((347, 364), 'PySide.QtGui.QHBoxLayout', 'QHBoxLayout', (['self'], {}), '(self)\n', (358, 364), False, 'from PySide.QtGui import QHBoxLayout\n'), ((467, 482), 'PySide.Qt... |
import requests
from faker import Faker
from API.common import APIBase
from src.custom_types import News, TokenDict
from src.shortcuts import render_text_default
class DiscordAPI(APIBase):
LOGGING_NAME = __name__
JSON_KEY = "discord"
def broadcast_prod(self, news: News, tokens: TokenDict) -> None:
... | [
"requests.post",
"src.shortcuts.render_text_default"
] | [((339, 364), 'src.shortcuts.render_text_default', 'render_text_default', (['news'], {}), '(news)\n', (358, 364), False, 'from src.shortcuts import render_text_default\n'), ((562, 598), 'requests.post', 'requests.post', (['api_uri'], {'json': 'payload'}), '(api_uri, json=payload)\n', (575, 598), False, 'import requests... |
from __future__ import print_function
import readline
import shlex
import six
import sys
from .exceptions import JSHError
class JSH(object):
section = None
def __init__(
self,
layout,
prompt='> ',
section_delims=('(', ')'),
ignore_case=False,
complete_on_spac... | [
"readline.set_completer",
"readline.set_completer_delims",
"readline.parse_and_bind",
"readline.get_line_buffer",
"sys.exit",
"six.iteritems",
"readline.get_endidx"
] | [((484, 530), 'readline.parse_and_bind', 'readline.parse_and_bind', (['"""set bell-style none"""'], {}), "('set bell-style none')\n", (507, 530), False, 'import readline\n'), ((539, 579), 'readline.parse_and_bind', 'readline.parse_and_bind', (['"""tab: complete"""'], {}), "('tab: complete')\n", (562, 579), False, 'impo... |