code stringlengths 22 1.05M | apis listlengths 1 3.31k | extract_api stringlengths 75 3.25M |
|---|---|---|
# oci-utils
#
# Copyright (c) 2019, 2020 Oracle and/or its affiliates. All rights reserved.
# Licensed under the Universal Permissive License v 1.0 as shown
# at http://oss.oracle.com/licenses/upl.
"""
Module to handle template type formatted virtual disk images.
"""
import logging
import os
import struct
from oci_ut... | [
"oci_utils.migrate.result_msg",
"oci_utils.migrate.exception.OciMigrateException",
"os.stat",
"struct.unpack",
"struct.calcsize",
"os.path.split",
"logging.getLogger"
] | [((818, 866), 'logging.getLogger', 'logging.getLogger', (['"""oci-utils.template-img-type"""'], {}), "('oci-utils.template-img-type')\n", (835, 866), False, 'import logging\n'), ((1681, 1718), 'struct.calcsize', 'struct.calcsize', (['templatetypehead_fmt'], {}), '(templatetypehead_fmt)\n', (1696, 1718), False, 'import ... |
import collections
import numpy
__all__ = [
"Output",
]
Output = collections.namedtuple("Output", ["type", "format", "time", "labels", "data"])
def to_output(file_type, file_format, labels_order, headers, times, labels, variables):
"""Create an Output namedtuple."""
outputs = [
Output(
... | [
"numpy.transpose",
"numpy.array",
"collections.namedtuple"
] | [((73, 151), 'collections.namedtuple', 'collections.namedtuple', (['"""Output"""', "['type', 'format', 'time', 'labels', 'data']"], {}), "('Output', ['type', 'format', 'time', 'labels', 'data'])\n", (95, 151), False, 'import collections\n'), ((391, 409), 'numpy.array', 'numpy.array', (['label'], {}), '(label)\n', (402,... |
"""Test NETCONF Lock - unit-tests."""
from unittest.mock import patch
from nornir_netconf.plugins.tasks import netconf_lock
from tests.conftest import FakeRpcObject
# from nornir_utils.plugins.functions import print_result
def test_netconf_lock(nornir):
"""Test Netconf Lock, operation not found."""
nr = nor... | [
"unittest.mock.patch",
"tests.conftest.FakeRpcObject"
] | [((463, 496), 'unittest.mock.patch', 'patch', (['"""ncclient.manager.Manager"""'], {}), "('ncclient.manager.Manager')\n", (468, 496), False, 'from unittest.mock import patch\n'), ((498, 535), 'unittest.mock.patch', 'patch', (['"""ncclient.manager.connect_ssh"""'], {}), "('ncclient.manager.connect_ssh')\n", (503, 535), ... |
from django.urls import path
from students.views import StudentsView, StudentsAddView
urlpatterns = [
path('manage', StudentsView.as_view(), name='index'),
path('add', StudentsAddView.as_view(), name='students_add')
]
| [
"students.views.StudentsView.as_view",
"students.views.StudentsAddView.as_view"
] | [((123, 145), 'students.views.StudentsView.as_view', 'StudentsView.as_view', ([], {}), '()\n', (143, 145), False, 'from students.views import StudentsView, StudentsAddView\n'), ((178, 203), 'students.views.StudentsAddView.as_view', 'StudentsAddView.as_view', ([], {}), '()\n', (201, 203), False, 'from students.views imp... |
""" Cisco_IOS_XR_lib_keychain_macsec_cfg
This module contains a collection of YANG definitions
for Cisco IOS\-XR lib\-keychain\-macsec package configuration.
This module contains definitions
for the following management objects\:
mac\-sec\-keychains\: Configure a Key Chain
Copyright (c) 2013\-2016 by Cisco System... | [
"ydk.errors.YPYModelError",
"ydk.types.YList"
] | [((2327, 2334), 'ydk.types.YList', 'YList', ([], {}), '()\n', (2332, 2334), False, 'from ydk.types import Empty, YList, YLeafList, DELETE, Decimal64, FixedBitsDict\n'), ((3758, 3765), 'ydk.types.YList', 'YList', ([], {}), '()\n', (3763, 3765), False, 'from ydk.types import Empty, YList, YLeafList, DELETE, Decimal64, Fi... |
import os
import sys
import getopt
import logging
def command_line_to_cgi_args():
"""It is possible to run these scripts as CGI scripts.
But is is also possible to run them as command line scripts
http://thehost/survol/sources_types/TheClass/the_script.py?xid=TheClass.arg1=val1,arg2=val2
becomes :
... | [
"os.path.split",
"logging.debug",
"getopt.getopt",
"sys.exit"
] | [((973, 1018), 'logging.debug', 'logging.debug', (["('script_name=%s' % script_name)"], {}), "('script_name=%s' % script_name)\n", (986, 1018), False, 'import logging\n'), ((1038, 1064), 'os.path.split', 'os.path.split', (['script_name'], {}), '(script_name)\n', (1051, 1064), False, 'import os\n'), ((1396, 1461), 'geto... |
from django.contrib import admin
from apps.ops import models
class AdhocAdmin(admin.ModelAdmin):
list_display = ('id', 'name', 'hosts', 'tasks')
# Register your models here.
admin.site.register(models.Adhoc, AdhocAdmin) | [
"django.contrib.admin.site.register"
] | [((182, 227), 'django.contrib.admin.site.register', 'admin.site.register', (['models.Adhoc', 'AdhocAdmin'], {}), '(models.Adhoc, AdhocAdmin)\n', (201, 227), False, 'from django.contrib import admin\n')] |
from __future__ import division, print_function
from hoomd import *
from hoomd import hpmc
import unittest
import os
import numpy
context.initialize()
def create_empty(**kwargs):
snap = data.make_snapshot(**kwargs);
return init.read_snapshot(snap);
# test overlaps of faceted sphere configurations
class facet... | [
"unittest.main",
"hoomd.hpmc.integrate.faceted_sphere"
] | [((2123, 2160), 'unittest.main', 'unittest.main', ([], {'argv': "['test.py', '-v']"}), "(argv=['test.py', '-v'])\n", (2136, 2160), False, 'import unittest\n'), ((1801, 1850), 'hoomd.hpmc.integrate.faceted_sphere', 'hpmc.integrate.faceted_sphere', ([], {'seed': '(123)', 'd': '(0)', 'a': '(0)'}), '(seed=123, d=0, a=0)\n'... |
#importdefs
import bpy
from g_tools.bpy_itfc_funcs import curve_fs
from bpy_extras.io_utils import ImportHelper
from bpy.props import StringProperty, BoolProperty, EnumProperty, CollectionProperty
from bpy.types import Operator
#fdef
#opdef
class simple_hair_curve_op(bpy.types.Operator):
"""NODESC"""
bl_idn... | [
"bpy.props.BoolProperty",
"g_tools.bpy_itfc_funcs.curve_fs.curve_to_armature",
"g_tools.bpy_itfc_funcs.curve_fs.simple_hair_curve",
"bpy.utils.unregister_class",
"bpy.props.StringProperty",
"bpy.utils.register_class"
] | [((537, 614), 'bpy.props.BoolProperty', 'bpy.props.BoolProperty', ([], {'name': '"""Set radius of last point to zero"""', 'default': '(True)'}), "(name='Set radius of last point to zero', default=True)\n", (559, 614), False, 'import bpy\n'), ((637, 708), 'bpy.props.BoolProperty', 'bpy.props.BoolProperty', ([], {'name':... |
from re import search
def increment_string(s):
num_match = search(r"(0|[1-9]\d*)$", s)
str_end = num_match.start() if num_match else len(s)
num = int(num_match.group()) if num_match else 0
if (str_end > 0 and s[str_end-1] == '0' and len(str(num+1)) > len(str(num))):
str_end -= 1
return s[:s... | [
"re.search"
] | [((64, 91), 're.search', 'search', (['"""(0|[1-9]\\\\d*)$"""', 's'], {}), "('(0|[1-9]\\\\d*)$', s)\n", (70, 91), False, 'from re import search\n')] |
import logging
from budgetportal import models
from django import forms
from django.core.exceptions import ValidationError
from django.db.models import NOT_PROVIDED, Q
from django.utils.text import slugify
from import_export import resources
from import_export.admin import ImportForm
from import_export.fields import F... | [
"budgetportal.models.Sphere.objects.all",
"django.core.exceptions.ValidationError",
"budgetportal.models.Sphere.objects.get",
"budgetportal.models.InfrastructureProjectPart.get_provinces",
"django.db.models.Q",
"import_export.fields.Field",
"django.utils.text.slugify",
"budgetportal.models.Department.... | [((439, 466), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (456, 466), False, 'import logging\n'), ((3942, 3996), 'import_export.fields.Field', 'Field', ([], {'attribute': '"""name"""', 'column_name': '"""department_name"""'}), "(attribute='name', column_name='department_name')\n", (394... |
from lookup_extensions.manager import Manager
try:
from lookup.models import (
Article as LookupArticle,
Game,
Player,
Season,
Tag,
)
from or_lookups.models import (
Article as OrLookupsArticle,
)
from reverse_lookup.models import (
Choice,
... | [
"lookup_extensions.manager.Manager"
] | [((958, 967), 'lookup_extensions.manager.Manager', 'Manager', ([], {}), '()\n', (965, 967), False, 'from lookup_extensions.manager import Manager\n')] |
# Generated by Django 3.1.2 on 2020-10-13 07:15
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='Car',
fields=[
... | [
"django.db.models.OneToOneField",
"django.db.models.CharField",
"django.db.models.ForeignKey",
"django.db.models.AutoField",
"django.db.models.DateTimeField"
] | [((332, 425), 'django.db.models.AutoField', 'models.AutoField', ([], {'auto_created': '(True)', 'primary_key': '(True)', 'serialize': '(False)', 'verbose_name': '"""ID"""'}), "(auto_created=True, primary_key=True, serialize=False,\n verbose_name='ID')\n", (348, 425), False, 'from django.db import migrations, models\... |
import unittest
from Application import app, db
from Application.db_operations import *
class DBOperationsTests(unittest.TestCase):
def setUp(self):
self.existing_researcher = Researchers(phone_id='123', name='test', surname='test')
app.config.from_pyfile('../Tests/testing_conf.py')
self.a... | [
"Application.db.drop_all",
"Application.app.test_client",
"Application.db.create_all",
"Application.app.config.from_pyfile",
"Application.db.session.remove"
] | [((255, 305), 'Application.app.config.from_pyfile', 'app.config.from_pyfile', (['"""../Tests/testing_conf.py"""'], {}), "('../Tests/testing_conf.py')\n", (277, 305), False, 'from Application import app, db\n'), ((325, 342), 'Application.app.test_client', 'app.test_client', ([], {}), '()\n', (340, 342), False, 'from App... |
#!/usr/bin/env python
#
# Software License Agreement (BSD License)
#
# Copyright (c) 2017, TNO IVS, Helmond, Netherlands
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# * Redistributions of... | [
"diagnostic_common_diagnostics.cpu_monitor.main",
"argparse.ArgumentParser"
] | [((1944, 1960), 'argparse.ArgumentParser', 'ArgumentParser', ([], {}), '()\n', (1958, 1960), False, 'from argparse import ArgumentParser\n'), ((2214, 2232), 'diagnostic_common_diagnostics.cpu_monitor.main', 'cpu_monitor.main', ([], {}), '()\n', (2230, 2232), False, 'from diagnostic_common_diagnostics import cpu_monitor... |
# Um professor quer sortear um dos seus quatro alunos para apagar o quadro. Faça um programa que ajude ele,
# lendo o nome deles e escrevendo o nome escolhido.
import random
aluno1 = input('Digite o nome do 1º aluno: ')
aluno2 = input('Digite o nome do 2º aluno: ')
aluno3 = input('Digite o nome do 3º aluno: ')
aluno4... | [
"random.choice"
] | [((414, 435), 'random.choice', 'random.choice', (['alunos'], {}), '(alunos)\n', (427, 435), False, 'import random\n')] |
import numpy as np
x = 1.0
y = 2.0
#exponents and logarithms
print(np.exp(x)) #e^x
print(np.log(x)) #ln x
print(np.log10(x)) #log_10 x
print(np.log2(x)) #log_2 x
#min/max/misc
print(np.fabs(x)) #absolute cal as a float
print(np.fmin(x,y)) #min of x and y
print(np.fmax(x,y)) #max of x and y
#populate arrays
n = 1... | [
"numpy.fmin",
"numpy.fmax",
"numpy.log",
"numpy.log2",
"numpy.sin",
"numpy.arange",
"numpy.exp",
"numpy.fabs",
"numpy.interp",
"numpy.log10"
] | [((327, 352), 'numpy.arange', 'np.arange', (['n'], {'dtype': 'float'}), '(n, dtype=float)\n', (336, 352), True, 'import numpy as np\n'), ((416, 425), 'numpy.sin', 'np.sin', (['z'], {}), '(z)\n', (422, 425), True, 'import numpy as np\n'), ((69, 78), 'numpy.exp', 'np.exp', (['x'], {}), '(x)\n', (75, 78), True, 'import nu... |
from pyspark.sql import Row, SparkSession
from pyspark.sql.functions import col, lower, lit, upper, initcap, length, from_unixtime, substring, length, expr, \
current_date
##redditor = df.drop('_c0')
import getpass
import logging
username = getpass.getuser()
def main(spark):
logging.basicConfig(level=logging... | [
"getpass.getuser",
"logging.basicConfig",
"pyspark.sql.functions.expr",
"pyspark.sql.SparkSession.builder.config",
"pyspark.sql.functions.lit",
"pyspark.sql.functions.from_unixtime",
"pyspark.sql.functions.current_date",
"pyspark.sql.functions.col"
] | [((246, 263), 'getpass.getuser', 'getpass.getuser', ([], {}), '()\n', (261, 263), False, 'import getpass\n'), ((287, 383), 'logging.basicConfig', 'logging.basicConfig', ([], {'level': 'logging.CRITICAL', 'format': '"""%(asctime)s:%(levelname)s:%(message)s"""'}), "(level=logging.CRITICAL, format=\n '%(asctime)s:%(lev... |
import hypothesis.strategies as st
from hypothesis import given
@given(st.integers(min_value = 0, max_value=10000))
def test(i):
print(i)
assert f < 5000
| [
"hypothesis.strategies.integers"
] | [((72, 113), 'hypothesis.strategies.integers', 'st.integers', ([], {'min_value': '(0)', 'max_value': '(10000)'}), '(min_value=0, max_value=10000)\n', (83, 113), True, 'import hypothesis.strategies as st\n')] |
import play
import behavior
import tactics.coordinated_pass
import tactics.forward_pass
import tactics.behavior_sequence
import robocup
import constants
import main
## Continually runs a coordinated pass to opposite sides of the field
class TestForwardPass(play.Play):
ReceiveXCoord = -constants.Field.Width / 4
... | [
"robocup.Point"
] | [((962, 1037), 'robocup.Point', 'robocup.Point', (['TestForwardPass.ReceiveXCoord', 'TestForwardPass.ReceiveYCoord'], {}), '(TestForwardPass.ReceiveXCoord, TestForwardPass.ReceiveYCoord)\n', (975, 1037), False, 'import robocup\n')] |
from datetime import datetime
class App_logger:
def __init__(self):
pass
def log(self,file_name,log_message):
self.now = datetime.now()
self.date = self.now.date()
self.time = self.now.strftime("%H:%M:%S")
file_name.write(str(self.date) + '\t' + str(self.time) +'\t\t' ... | [
"datetime.datetime.now"
] | [((148, 162), 'datetime.datetime.now', 'datetime.now', ([], {}), '()\n', (160, 162), False, 'from datetime import datetime\n')] |
from typing import Callable, Tuple, List, Union, Optional, Text
from datetime import datetime, timedelta, date
import pytz
from dateutil.parser import parse
class TimeUtils(object):
@classmethod
def utc_now(cls) -> datetime:
"""
Return a datetime in UTC timezone.
"""
return d... | [
"dateutil.parser.parse",
"datetime.datetime.now",
"datetime.datetime.fromtimestamp"
] | [((319, 341), 'datetime.datetime.now', 'datetime.now', (['pytz.utc'], {}), '(pytz.utc)\n', (331, 341), False, 'from datetime import datetime, timedelta, date\n'), ((1120, 1155), 'datetime.datetime.fromtimestamp', 'datetime.fromtimestamp', (['(0)', 'timezone'], {}), '(0, timezone)\n', (1142, 1155), False, 'from datetime... |
import day14
def test_masks_correctly1():
value = "000000000000000000000000000001100101"
mask = "XXXXXXXXXXXXXXXXXXXXXXXXXXXXX1XXXX0X"
_, masked_val = day14.mask_values(mask, value)
assert masked_val == 101, f"Masked value is wrong, is {masked_val}"
def test_masks_correctly2():
value = "0000000... | [
"day14.mask_and_apply_input",
"day14.mask_values",
"day14.mask_address"
] | [((166, 196), 'day14.mask_values', 'day14.mask_values', (['mask', 'value'], {}), '(mask, value)\n', (183, 196), False, 'import day14\n'), ((435, 465), 'day14.mask_values', 'day14.mask_values', (['mask', 'value'], {}), '(mask, value)\n', (452, 465), False, 'import day14\n'), ((797, 835), 'day14.mask_and_apply_input', 'd... |
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may... | [
"cairis.tools.SessionValidator.get_session_id",
"cairis.tools.JsonConverter.json_serialize",
"flask.request.args.get",
"cairis.data.ResponseDAO.ResponseDAO"
] | [((1511, 1543), 'cairis.tools.SessionValidator.get_session_id', 'get_session_id', (['session', 'request'], {}), '(session, request)\n', (1525, 1543), False, 'from cairis.tools.SessionValidator import get_session_id\n'), ((1564, 1601), 'flask.request.args.get', 'request.args.get', (['"""constraint_id"""', '(-1)'], {}), ... |
# congklak game environment
# version 1.0.0
import numpy as np
import random
class congklak_board:
def __init__(self):
# array to save the score, also function as the big holes' stone counter
self.score = np.full(shape=2, fill_value=0, dtype=np.int)
# array to save the state of th... | [
"numpy.full",
"numpy.savetxt",
"numpy.zeros",
"numpy.append",
"numpy.array",
"numpy.concatenate"
] | [((227, 271), 'numpy.full', 'np.full', ([], {'shape': '(2)', 'fill_value': '(0)', 'dtype': 'np.int'}), '(shape=2, fill_value=0, dtype=np.int)\n', (234, 271), True, 'import numpy as np\n'), ((7282, 7308), 'numpy.array', 'np.array', (['[]'], {'dtype': 'np.int'}), '([], dtype=np.int)\n', (7290, 7308), True, 'import numpy ... |
import smtplib
from email.mime.multipart import MIMEMultipart
from email.mime.text import MIMEText
def sendmail(email_recepients):
email_sender_account = "<EMAIL>"
email_sender_username = "<EMAIL>"
email_sender_password = "password"
email_smtp_server = "smtp.gmail.com"
email_smtp_port = 587
em... | [
"email.mime.multipart.MIMEMultipart",
"email.mime.text.MIMEText",
"smtplib.SMTP"
] | [((422, 470), 'smtplib.SMTP', 'smtplib.SMTP', (['email_smtp_server', 'email_smtp_port'], {}), '(email_smtp_server, email_smtp_port)\n', (434, 470), False, 'import smtplib\n'), ((659, 687), 'email.mime.multipart.MIMEMultipart', 'MIMEMultipart', (['"""alternative"""'], {}), "('alternative')\n", (672, 687), False, 'from e... |
# Copyright 2021 iiPython
# Modules
import os
import re
import shutil
# Console class
class Console(object):
def __init__(self) -> None:
self._clear_cmd = "clear" if os.name != "nt" else "cls"
# Color map
self._color_map = {
# Regular colors
"black": 30, "red": 31... | [
"shutil.get_terminal_size",
"re.findall",
"os.system"
] | [((1350, 1392), 're.findall', 're.findall', (['"""\\\\[\\\\/*[a-zA-Z]{1,}\\\\]"""', 'text'], {}), "('\\\\[\\\\/*[a-zA-Z]{1,}\\\\]', text)\n", (1360, 1392), False, 'import re\n'), ((1574, 1600), 'os.system', 'os.system', (['self._clear_cmd'], {}), '(self._clear_cmd)\n', (1583, 1600), False, 'import os\n'), ((1501, 1527)... |
# Generated by Django 3.2.5 on 2021-07-30 09:47
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('article', '0007_auto_20210730_1416'),
]
operations = [
migrations.AlterField(
model_name='squad_article',
name='min_... | [
"django.db.models.IntegerField"
] | [((346, 393), 'django.db.models.IntegerField', 'models.IntegerField', ([], {'verbose_name': '"""حداقل level"""'}), "(verbose_name='حداقل level')\n", (365, 393), False, 'from django.db import migrations, models\n'), ((532, 590), 'django.db.models.IntegerField', 'models.IntegerField', ([], {'verbose_name': '"""حداقل تایم... |
# Author: <NAME> <<EMAIL>>
# 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... | [
"sklearn.ensemble.RandomForestClassifier",
"sklearn.metrics.confusion_matrix",
"utils.saveStringToFilesystem",
"pandas.read_csv",
"utils.getFeatureLabelColumns",
"utils.applyPCA",
"utils.scaleUnitMean",
"utils.saveObjectToFilesystem",
"utils.buildPerformanceString",
"utils.getPredictedLabels",
"... | [((827, 854), 'configparser.ConfigParser', 'configparser.ConfigParser', ([], {}), '()\n', (852, 854), False, 'import configparser\n'), ((1640, 1681), 'utils.getPredictedLabels', 'utils.getPredictedLabels', (['model', 'features'], {}), '(model, features)\n', (1664, 1681), False, 'import utils\n'), ((1700, 1741), 'sklear... |
import OpenSSL
import botocore.session
import os
import io
import jks
import logging
import pytest
from acm_pca_cert_generator import certgen
from acm_common import truststore_utils
from botocore.stub import Stubber, ANY
try:
import mock
from mock import MagicMock
from mock import call
except ImportError:
... | [
"os.mkdir",
"os.remove",
"acm_common.truststore_utils.retrieve_key_and_cert_retryable",
"OpenSSL.crypto.PKey",
"os.path.join",
"acm_common.truststore_utils.get_aws_certificate_chain",
"unittest.mock.MagicMock",
"OpenSSL.crypto.X509",
"os.path.exists",
"acm_common.truststore_utils.generate_truststo... | [((954, 1022), 'acm_common.truststore_utils.get_aws_certificate_chain', 'truststore_utils.get_aws_certificate_chain', (['template_downloaded_data'], {}), '(template_downloaded_data)\n', (996, 1022), False, 'from acm_common import truststore_utils\n'), ((1587, 1655), 'acm_common.truststore_utils.get_aws_certificate_chai... |
import logging
from pathlib import Path
from magnus.integration import BaseIntegration
from magnus import defaults
logger = logging.getLogger(defaults.NAME)
class LocalComputeS3RunLogStore(BaseIntegration):
"""
Local compute and File system run log store
"""
mode_type = 'local'
service_type = 'r... | [
"pathlib.Path",
"logging.getLogger"
] | [((126, 158), 'logging.getLogger', 'logging.getLogger', (['defaults.NAME'], {}), '(defaults.NAME)\n', (143, 158), False, 'import logging\n'), ((1766, 1780), 'pathlib.Path', 'Path', (['write_to'], {}), '(write_to)\n', (1770, 1780), False, 'from pathlib import Path\n')] |
import sys, re, time
from collections import defaultdict
def chunkIt(seq, num):
avg = len(seq) / float(num)
out = []
last = 0.0
while last < len(seq):
out.append(seq[int(last):int(last + avg)])
last += avg
return out
class Token:
def __init__(self, separator='\t'):
self.id =... | [
"time.time",
"collections.defaultdict",
"re.search",
"re.sub",
"sys.exit"
] | [((4955, 4966), 'time.time', 'time.time', ([], {}), '()\n', (4964, 4966), False, 'import sys, re, time\n'), ((1027, 1044), 'collections.defaultdict', 'defaultdict', (['list'], {}), '(list)\n', (1038, 1044), False, 'from collections import defaultdict\n'), ((3090, 3100), 'sys.exit', 'sys.exit', ([], {}), '()\n', (3098, ... |
import cv2
im = cv2.imread('facerec1.png')
im1 = cv2.resize(im, (255, 255))
cv2.imwrite('recface.png', im1) | [
"cv2.imread",
"cv2.resize",
"cv2.imwrite"
] | [((17, 43), 'cv2.imread', 'cv2.imread', (['"""facerec1.png"""'], {}), "('facerec1.png')\n", (27, 43), False, 'import cv2\n'), ((50, 76), 'cv2.resize', 'cv2.resize', (['im', '(255, 255)'], {}), '(im, (255, 255))\n', (60, 76), False, 'import cv2\n'), ((77, 108), 'cv2.imwrite', 'cv2.imwrite', (['"""recface.png"""', 'im1']... |
# -*- coding: utf-8 -*-
"""
Created on Sat Oct 12 11:56:46 2019
@author: <NAME>
Assignment 1:
- Convert a RAW rgb image to a YUV format then Reconstruct the RGB channels.
- Compute the PSNR between the source rgb image and the Reconstructed RGB using
4:4:4, 4:2:2 and 4:1:1 format.
- You may select to use the averag... | [
"numpy.sum",
"math.sqrt",
"numpy.fromfile",
"cv2.cvtColor",
"cv2.imwrite",
"cv2.waitKey",
"cv2.destroyAllWindows",
"numpy.shape",
"cv2.imread",
"numpy.array",
"numpy.reshape",
"cv2.merge",
"cv2.imshow"
] | [((1307, 1368), 'numpy.fromfile', 'np.fromfile', (['"""Lena Gray Raw Image.txt"""'], {'dtype': '"""uint8"""', 'sep': '""""""'}), "('Lena Gray Raw Image.txt', dtype='uint8', sep='')\n", (1318, 1368), True, 'import numpy as np\n'), ((1375, 1398), 'numpy.reshape', 'np.reshape', (['img', '(W, H)'], {}), '(img, (W, H))\n', ... |
from datetime import datetime, timedelta
from enum import Enum
from apscheduler.triggers.date import DateTrigger
from . import ServiceBase
import logging
logger = logging.getLogger(__name__)
class ClockService(ServiceBase):
def get_next_trigger(self):
now = datetime.now()
now = now + timedelta... | [
"datetime.datetime.now",
"datetime.timedelta",
"logging.getLogger",
"datetime.datetime"
] | [((166, 193), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (183, 193), False, 'import logging\n'), ((276, 290), 'datetime.datetime.now', 'datetime.now', ([], {}), '()\n', (288, 290), False, 'from datetime import datetime, timedelta\n'), ((311, 331), 'datetime.timedelta', 'timedelta', ([... |
"""
Copyright (c) 2013 ICRL
See the file license.txt for copying permission.
"""
from xml.etree import ElementTree
import core
class GameParser:
"""
This class can import games from XML files using the :func:`loadXMLGameData` function.
:attributes:
- `game`: holds all the game data after :func:`loadXMLGameData... | [
"xml.etree.ElementTree.parse",
"core.components.Game",
"core.components.Effect",
"core.components.Condition",
"core.components.Scene"
] | [((2224, 2246), 'core.components.Game', 'core.components.Game', ([], {}), '()\n', (2244, 2246), False, 'import core\n'), ((5277, 5301), 'core.components.Effect', 'core.components.Effect', ([], {}), '()\n', (5299, 5301), False, 'import core\n'), ((6670, 6697), 'core.components.Condition', 'core.components.Condition', ([... |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.5 on 2018-01-03 06:39
from __future__ import unicode_literals
import datetime
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
... | [
"django.db.models.TextField",
"django.db.migrations.swappable_dependency",
"django.db.models.ForeignKey",
"django.db.models.FloatField",
"django.db.models.AutoField",
"datetime.datetime",
"django.db.models.IntegerField"
] | [((416, 473), 'django.db.migrations.swappable_dependency', 'migrations.swappable_dependency', (['settings.AUTH_USER_MODEL'], {}), '(settings.AUTH_USER_MODEL)\n', (447, 473), False, 'from django.db import migrations, models\n'), ((646, 739), 'django.db.models.AutoField', 'models.AutoField', ([], {'auto_created': '(True)... |
import apiAuth
from __swagger2__ import requests as swagRq
from __swagger2__ import responses as swagRsp
from v1 import statics as swagStc
PREFIX = swagStc.IGNITION_SWAGGER_CUSTOM_PREFIX
class GET(swagRq.HttpMethod):
SWAGGER = {
# CUSTOM KEYS FOR IA PURPOSES
PREFIX+'auth': [
{'method': apiAuth.simple.allowAl... | [
"__swagger2__.responses.httpStatus",
"__swagger2__.responses.json"
] | [((4958, 5052), '__swagger2__.responses.json', 'swagRsp.json', ([], {'success': '(True)', 'status': '"""SUCCESS"""', 'data': "{'description': 'successful operation'}"}), "(success=True, status='SUCCESS', data={'description':\n 'successful operation'})\n", (4970, 5052), True, 'from __swagger2__ import responses as sw... |
# Copyright (C) 2019 Google Inc.
# Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file>
"""
Set due_date for Fixed and Depricated Issues
Create Date: 2019-04-12 15:18:33.419112
"""
# disable Invalid constant name pylint warning for mandatory Alembic variables.
# pylint: disable=invalid-name
i... | [
"sqlalchemy.text",
"ggrc.migrations.utils.add_to_objects_without_revisions_bulk",
"json.loads",
"alembic.op.get_bind"
] | [((1639, 1703), 'sqlalchemy.text', 'sa.text', (['"""UPDATE issues SET due_date = :due_date WHERE id = :id"""'], {}), "('UPDATE issues SET due_date = :due_date WHERE id = :id')\n", (1646, 1703), True, 'import sqlalchemy as sa\n'), ((1859, 1872), 'alembic.op.get_bind', 'op.get_bind', ([], {}), '()\n', (1870, 1872), False... |
from collections import namedtuple
from datetime import datetime
from unittest.mock import patch
import pytest
from freezegun import freeze_time
from metaphor.common.event_util import EventUtil
from metaphor.redshift.usage.config import RedshiftUsageRunConfig
from metaphor.redshift.usage.extractor import RedshiftUsag... | [
"tests.test_utils.load_json",
"metaphor.redshift.usage.extractor.RedshiftUsageExtractor",
"datetime.datetime.fromisoformat",
"metaphor.common.event_util.EventUtil.trim_event",
"unittest.mock.patch",
"collections.namedtuple",
"freezegun.freeze_time",
"metaphor.redshift.usage.config.RedshiftUsageRunConf... | [((1295, 1320), 'freezegun.freeze_time', 'freeze_time', (['"""2022-01-17"""'], {}), "('2022-01-17')\n", (1306, 1320), False, 'from freezegun import freeze_time\n'), ((417, 432), 'tests.test_utils.load_json', 'load_json', (['path'], {}), '(path)\n', (426, 432), False, 'from tests.test_utils import load_json\n'), ((1375,... |
from rest_framework import viewsets
from rest_framework import permissions
from rest_framework import filters
from api.user.permissions import IsOwnerOfObject
from user.models import Hashmap
from api.hashmap.serializers import HashmapSerializer
class HashmapViewSet(viewsets.ModelViewSet):
"""
API endpoint tha... | [
"user.models.Hashmap.objects.filter"
] | [((810, 856), 'user.models.Hashmap.objects.filter', 'Hashmap.objects.filter', ([], {'user': 'self.request.user'}), '(user=self.request.user)\n', (832, 856), False, 'from user.models import Hashmap\n')] |
#!/usr/bin/env python
#
# ___INFO__MARK_BEGIN__
#######################################################################################
# Copyright 2016-2021 Univa Corporation (acquired and owned by Altair Engineering Inc.)
# Licensed under the Apache License, Version 2.0 (the "License"); you may not
# use this file e... | [
"tempfile.NamedTemporaryFile",
"os.remove",
"nose.tools.make_decorator",
"nose.SkipTest",
"os.path.exists",
"random.choice",
"uge.config.config_manager.ConfigManager.get_instance",
"uge.exceptions.configuration_error.ConfigurationError"
] | [((2196, 2221), 'os.path.exists', 'os.path.exists', (['file_path'], {}), '(file_path)\n', (2210, 2221), False, 'import os\n'), ((2838, 2866), 'uge.config.config_manager.ConfigManager.get_instance', 'ConfigManager.get_instance', ([], {}), '()\n', (2864, 2866), False, 'from uge.config.config_manager import ConfigManager\... |
import math
import numpy as np
import scipy as s
import scipy.integrate as q
import matplotlib.pyplot as plt
#Constants
H0 = 2.19507453e-18 #using 67.74
Wm = 0.279
Wq = 1 - Wm
w = -1
#Basic Functions
def H(a):
return H0*np.sqrt(Wm*a**(-3) + Wq*a**(-3*(1+w)))
def dH(a):
return (H0**2/(2*H(a)))*(-3*Wm*a**(-4) -... | [
"matplotlib.pyplot.title",
"matplotlib.pyplot.subplot",
"matplotlib.pyplot.xlim",
"matplotlib.pyplot.show",
"matplotlib.pyplot.plot",
"scipy.integrate.quad",
"scipy.integrate.odeint",
"matplotlib.pyplot.legend",
"matplotlib.pyplot.figure",
"numpy.linspace",
"matplotlib.pyplot.ylabel",
"matplot... | [((1292, 1313), 'numpy.linspace', 'np.linspace', (['a0', '(1)', 'N'], {}), '(a0, 1, N)\n', (1303, 1313), True, 'import numpy as np\n'), ((1319, 1339), 'scipy.integrate.odeint', 'q.odeint', (['z3', 'y30', 'a'], {}), '(z3, y30, a)\n', (1327, 1339), True, 'import scipy.integrate as q\n'), ((1443, 1456), 'matplotlib.pyplot... |
# -*- coding: utf-8 -*-
from __future__ import (absolute_import, division,
print_function, unicode_literals)
from gevent import monkey
monkey.patch_all()
import unittest
import gevent
import ws4py
from ws4py.client.geventclient import WebSocketClient
class WebsocketTest(unittest.TestCase):
... | [
"gevent.monkey.patch_all",
"ws4py.client.geventclient.WebSocketClient"
] | [((159, 177), 'gevent.monkey.patch_all', 'monkey.patch_all', ([], {}), '()\n', (175, 177), False, 'from gevent import monkey\n'), ((373, 414), 'ws4py.client.geventclient.WebSocketClient', 'WebSocketClient', (['"""ws://127.0.0.1:5080/ws"""'], {}), "('ws://127.0.0.1:5080/ws')\n", (388, 414), False, 'from ws4py.client.gev... |
import pytest
import random
import typing
from slack_blockkit.block_element import (
ButtonElement,
DangerButtonElement,
DatepickerElement,
DefaultButtonElement,
ImageElement,
OverflowElement,
PlainTextInputElement,
PrimaryButtonElement,
RadioButtonGroupElement,
)
from slack_blockki... | [
"slack_blockkit.block_element.RadioButtonGroupElement",
"random.randint",
"slack_blockkit.layout_block.FileBlock",
"slack_blockkit.composition_object.PlainTextObject",
"slack_blockkit.composition_object.TextObject",
"slack_blockkit.composition_object.MarkdownTextObject",
"slack_blockkit.block_element.Im... | [((991, 1076), 'slack_blockkit.composition_object.TextObject', 'TextObject', ([], {'btype': 'TextObject.BTYPE_MARKDOWN', 'text': '"""Sandy cheeks lives in a dome"""'}), "(btype=TextObject.BTYPE_MARKDOWN, text='Sandy cheeks lives in a dome'\n )\n", (1001, 1076), False, 'from slack_blockkit.composition_object import C... |
from tkinter import filedialog
from tkinter import *
import os
# get image data: ############################################################
def Get_image_data(window):
desktop_folder = os.path.expanduser("~/Desktop")
open_file = filedialog.askopenfile(initialdir = desktop_folder,
... | [
"os.path.split",
"os.path.expanduser",
"tkinter.filedialog.askopenfile"
] | [((192, 223), 'os.path.expanduser', 'os.path.expanduser', (['"""~/Desktop"""'], {}), "('~/Desktop')\n", (210, 223), False, 'import os\n'), ((239, 484), 'tkinter.filedialog.askopenfile', 'filedialog.askopenfile', ([], {'initialdir': 'desktop_folder', 'parent': 'window', 'mode': '"""rb"""', 'title': '"""Choisissez un fic... |
#!/usr/bin/env python3
# Copyright (c) 2020 The Bitcoin Unlimited developers
"""
Tests the electrum call 'blockchain.transaction.get'
"""
import asyncio
from test_framework.util import assert_equal, p2p_port
from test_framework.electrumutil import ElectrumTestFramework, ElectrumConnection
from test_framework.nodemessag... | [
"asyncio.get_event_loop",
"test_framework.script.CScript",
"test_framework.blocktools.pad_tx",
"test_framework.electrumutil.ElectrumConnection",
"test_framework.nodemessages.ToHex",
"test_framework.util.assert_equal"
] | [((2755, 2779), 'asyncio.get_event_loop', 'asyncio.get_event_loop', ([], {}), '()\n', (2777, 2779), False, 'import asyncio\n'), ((2160, 2170), 'test_framework.blocktools.pad_tx', 'pad_tx', (['tx'], {}), '(tx)\n', (2166, 2170), False, 'from test_framework.blocktools import create_transaction, pad_tx\n'), ((2314, 2335), ... |
import os
import numpy as np
import pandas as pd
from scipy.io import loadmat, savemat
import matplotlib.pyplot as plt
import seaborn as sns
def match_strings(strings, path, any_or_all='any'):
if any_or_all == 'any':
return any([string in path for string in strings])
elif any_or_all == 'all':
r... | [
"os.remove",
"numpy.abs",
"scipy.io.loadmat",
"numpy.mean",
"numpy.diag",
"os.path.join",
"numpy.unique",
"numpy.atleast_2d",
"pandas.DataFrame",
"seaborn.reset_defaults",
"shutil.copyfile",
"matplotlib.pyplot.subplots",
"numpy.repeat",
"seaborn.scatterplot",
"matplotlib.pyplot.legend",
... | [((3043, 3066), 'numpy.atleast_2d', 'np.atleast_2d', (['data_vec'], {}), '(data_vec)\n', (3056, 3066), True, 'import numpy as np\n'), ((4643, 4686), 'pandas.to_numeric', 'pd.to_numeric', (["df['value']"], {'errors': '"""coerce"""'}), "(df['value'], errors='coerce')\n", (4656, 4686), True, 'import pandas as pd\n'), ((47... |
import requests
import os
import threading
import urllib3
from bs4 import BeautifulSoup
from concurrent.futures import ThreadPoolExecutor
from selenium import webdriver
from selenium.common import exceptions
urllib3.disable_warnings()
divide_line = "———————————— {} ————————————"
def cjg_crawl(info, index="", downloa... | [
"os.mkdir",
"os.path.exists",
"requests.get",
"selenium.webdriver.Chrome",
"bs4.BeautifulSoup",
"concurrent.futures.ThreadPoolExecutor",
"threading.current_thread",
"urllib3.disable_warnings"
] | [((208, 234), 'urllib3.disable_warnings', 'urllib3.disable_warnings', ([], {}), '()\n', (232, 234), False, 'import urllib3\n'), ((557, 601), 'requests.get', 'requests.get', (['url'], {'timeout': '(120)', 'verify': '(False)'}), '(url, timeout=120, verify=False)\n', (569, 601), False, 'import requests\n'), ((615, 654), '... |
import os
import click
import scphylo as scp
@click.command(short_help="Run OncoNEM.")
@click.argument(
"genotype_file",
required=True,
type=click.Path(
exists=True, file_okay=True, dir_okay=False, readable=True, resolve_path=True
),
)
@click.argument(
"alpha",
required=True,
typ... | [
"click.argument",
"scphylo.io.read",
"click.command",
"scphylo.tl.onconem",
"scphylo.io.write",
"os.path.splitext",
"click.Path"
] | [((50, 90), 'click.command', 'click.command', ([], {'short_help': '"""Run OncoNEM."""'}), "(short_help='Run OncoNEM.')\n", (63, 90), False, 'import click\n'), ((265, 315), 'click.argument', 'click.argument', (['"""alpha"""'], {'required': '(True)', 'type': 'float'}), "('alpha', required=True, type=float)\n", (279, 315)... |
#!/usr/bin/env python
#
# // SPDX-License-Identifier: BSD-3-CLAUSE
#
# (C) Copyright 2018, Xilinx, Inc.
#
import os
import json
import argparse
from collections import OrderedDict
import h5py
import ntpath
import cv2
import numpy as np
from xfdnn.rt.xdnn_util import literal_eval
from ext.PyTurboJPEG import imread as ... | [
"argparse.ArgumentParser",
"xfdnn.tools.compile.bin.xfdnn_compiler_caffe.default_compiler_arg_parser",
"os.walk",
"numpy.argsort",
"os.path.isfile",
"os.path.join",
"os.path.abspath",
"os.path.exists",
"numpy.transpose",
"cv2.resize",
"numpy.stack",
"h5py.File",
"numpy.asarray",
"xfdnn.too... | [((1306, 1351), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""pyXDNN"""'}), "(description='pyXDNN')\n", (1329, 1351), False, 'import argparse\n'), ((4937, 4989), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""XDLF_compiled"""'}), "(description='XDLF_compi... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Sat Jul 21 15:17:03 2018
Renames the files from the microscope into pattern: Well, Date, FoV, channel
@author: max
"""
import os
from os.path import isfile, join
import re
import sys
path='/Users/max/Desktop/Office/Phd/Data/N1E_115/SiRNA/SiRNA_28/timelap... | [
"os.makedirs",
"os.rename",
"os.path.exists",
"os.chdir",
"re.search",
"os.path.join",
"os.listdir",
"re.compile"
] | [((343, 383), 're.compile', 're.compile', (['""".tif$"""'], {'flags': 're.IGNORECASE'}), "('.tif$', flags=re.IGNORECASE)\n", (353, 383), False, 'import re\n'), ((426, 440), 'os.chdir', 'os.chdir', (['path'], {}), '(path)\n', (434, 440), False, 'import os\n'), ((639, 655), 'os.listdir', 'os.listdir', (['path'], {}), '(p... |
"""
:codeauthor: <NAME> <<EMAIL>>
"""
import pytest
import salt.pillar.netbox as netbox
from tests.support.mock import patch
@pytest.fixture
def default_kwargs():
return {
"minion_id": "minion1",
"pillar": None,
"api_url": "http://netbox.example.com",
"api_token": "ye<PASSWORD... | [
"salt.pillar.netbox._associate_ips_to_interfaces",
"salt.pillar.netbox._get_virtual_machines",
"salt.pillar.netbox._get_interface_ips",
"salt.pillar.netbox._get_site_details",
"salt.pillar.netbox._get_site_prefixes",
"salt.pillar.netbox._get_proxy_details",
"tests.support.mock.patch",
"salt.pillar.net... | [((51555, 51590), 'salt.pillar.netbox.ext_pillar', 'netbox.ext_pillar', ([], {}), '(**default_kwargs)\n', (51572, 51590), True, 'import salt.pillar.netbox as netbox\n'), ((61088, 61160), 'salt.pillar.netbox._associate_ips_to_interfaces', 'netbox._associate_ips_to_interfaces', (['interfaces_list', 'interface_ips_list'],... |
# from distutils.core import setup
from setuptools import setup
setup(
name='gp_project',
# packages=['gp_project'],
py_modules=['gp_project'],
version='0.1',
description='A Gaussian Process Project for STAT8810 at OSU',
author='<NAME>, <NAME>, <NAME>',
author_email='<EMAIL>',
license='... | [
"setuptools.setup"
] | [((65, 879), 'setuptools.setup', 'setup', ([], {'name': '"""gp_project"""', 'py_modules': "['gp_project']", 'version': '"""0.1"""', 'description': '"""A Gaussian Process Project for STAT8810 at OSU"""', 'author': '"""<NAME>, <NAME>, <NAME>"""', 'author_email': '"""<EMAIL>"""', 'license': '"""MIT"""', 'url': '"""https:/... |
import asyncio
import contextlib
import datetime
import functools
import importlib
import inspect
import logging
import pathlib
import types
from typing import Any, Awaitable, Callable, Iterable, Optional, Type, TypeVar
import dateutil.parser
from procrastinate import exceptions
T = TypeVar("T")
U = TypeVar("U")
lo... | [
"asyncio.get_event_loop",
"importlib.import_module",
"asyncio.new_event_loop",
"asyncio.set_event_loop",
"procrastinate.exceptions.LoadFromPathError",
"asyncio.iscoroutinefunction",
"inspect.getmodule",
"pathlib.Path",
"functools.wraps",
"typing.TypeVar",
"datetime.datetime.now",
"logging.getL... | [((287, 299), 'typing.TypeVar', 'TypeVar', (['"""T"""'], {}), "('T')\n", (294, 299), False, 'from typing import Any, Awaitable, Callable, Iterable, Optional, Type, TypeVar\n'), ((304, 316), 'typing.TypeVar', 'TypeVar', (['"""U"""'], {}), "('U')\n", (311, 316), False, 'from typing import Any, Awaitable, Callable, Iterab... |
# day04.py
# <NAME>, <EMAIL> DOT <EMAIL>
from collections import defaultdict as ddict
import operator
import os
import re
import sys
a_ans = None
b_ans = None
# sol() allows for summarized solutions
def sol():
f = open( os.path.join( os.path.dirname(__file__), "../inputs/day04.txt" ), 'r' )
notes = sorted( [... | [
"os.path.dirname",
"collections.defaultdict",
"re.findall",
"operator.itemgetter",
"sys.exit"
] | [((504, 515), 'collections.defaultdict', 'ddict', (['list'], {}), '(list)\n', (509, 515), True, 'from collections import defaultdict as ddict\n'), ((1184, 1194), 'collections.defaultdict', 'ddict', (['int'], {}), '(int)\n', (1189, 1194), True, 'from collections import defaultdict as ddict\n'), ((1899, 1909), 'sys.exit'... |
import json
import tangelo
from startrek import DBSession
from startrek import Episode
@tangelo.types(sort=json.loads)
def run(sort=False):
session = DBSession()
count = {}
episodes = session.query(Episode)
for ep in episodes:
seen = set()
for writer in ep.teleplay:
count... | [
"startrek.DBSession",
"tangelo.types"
] | [((91, 121), 'tangelo.types', 'tangelo.types', ([], {'sort': 'json.loads'}), '(sort=json.loads)\n', (104, 121), False, 'import tangelo\n'), ((157, 168), 'startrek.DBSession', 'DBSession', ([], {}), '()\n', (166, 168), False, 'from startrek import DBSession\n')] |
from PIL import Image
from torchvision import transforms
import torch
from torch.utils import data
import torch.nn.functional as F
import numpy as np
import pandas as pd
import json
import copy
from sklearn import metrics
import sys, getopt
import os
import glob
import random
import collections
import time
from tqdm ... | [
"os.mkdir",
"argparse.ArgumentParser",
"numpy.argmax",
"pandas.read_csv",
"torch.cuda.device_count",
"torch.cuda.current_device",
"torchvision.transforms.Normalize",
"torch.no_grad",
"sys.path.append",
"pandas.DataFrame",
"numpy.copy",
"Data_Generator.Dataset_WSI",
"torch.utils.data.DataLoad... | [((354, 382), 'sys.path.append', 'sys.path.append', (['"""../utils/"""'], {}), "('../utils/')\n", (369, 382), False, 'import sys, getopt\n'), ((568, 628), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""TMA patches extractor"""'}), "(description='TMA patches extractor')\n", (591, 628), Fa... |
#! /usr/bin/env python
# -*- coding: utf-8 -*-
from st2tests.base import BaseActionTestCase
from mock import MagicMock, patch
import json
import yaml
import os
import sys
import re
BASE_DIR = '/opt/stackstorm/packs/mydemo_pack'
sys.path.append(BASE_DIR)
sys.path.append(BASE_DIR + '/actions/scripts')
sys.path.append('... | [
"sys.path.append",
"mock.patch"
] | [((230, 255), 'sys.path.append', 'sys.path.append', (['BASE_DIR'], {}), '(BASE_DIR)\n', (245, 255), False, 'import sys\n'), ((256, 302), 'sys.path.append', 'sys.path.append', (["(BASE_DIR + '/actions/scripts')"], {}), "(BASE_DIR + '/actions/scripts')\n", (271, 302), False, 'import sys\n'), ((303, 394), 'sys.path.append... |
#!/usr/bin/env python3
'''
Requirements:
$ pip3 install pygithub
Go to https://github.com/settings/tokens and make a personal access
token with full permissions to the repo and org.
'''
import csv
from github import Github
from pprint import pprint
#---------------------------------------------------------------... | [
"csv.DictWriter",
"pprint.pprint",
"github.Github"
] | [((553, 566), 'github.Github', 'Github', (['token'], {}), '(token)\n', (559, 566), False, 'from github import Github\n'), ((2372, 2385), 'pprint.pprint', 'pprint', (['repos'], {}), '(repos)\n', (2378, 2385), False, 'from pprint import pprint\n'), ((2386, 2405), 'pprint.pprint', 'pprint', (['all_members'], {}), '(all_me... |
from abc import ABC, abstractmethod
import numpy as np
class User(ABC):
"""
User in the typing environment. Can be simulated or a real user.
:param input_dim: (Tuple(int)) The dimensionality of the inputs this users produces.
"""
def __init__(self, input_dim, n_samples, baseline_temp, boltzmann_e... | [
"numpy.squeeze",
"numpy.sum",
"numpy.exp",
"numpy.array"
] | [((1370, 1386), 'numpy.squeeze', 'np.squeeze', (['pred'], {}), '(pred)\n', (1380, 1386), True, 'import numpy as np\n'), ((1924, 1933), 'numpy.exp', 'np.exp', (['x'], {}), '(x)\n', (1930, 1933), True, 'import numpy as np\n'), ((1964, 1984), 'numpy.sum', 'np.sum', (['unnormalized'], {}), '(unnormalized)\n', (1970, 1984),... |
# -*- coding: utf-8 -*-
"""
Author: @heyao
Created On: 2019/7/3 上午11:16
"""
import re
from itertools import chain
import jieba
from knowledge_graph.info_extract.word_category import *
from knowledge_graph.info_extract.corpus import *
def max_tokenize(text, corpus_check, maxlen=8):
start_idx = 0
while start... | [
"textwrap.fill",
"jieba.add_word",
"jieba.cut",
"jieba.suggest_freq",
"knowledge_graph.info_extract.utils.merge_partial_words",
"collections.OrderedDict",
"re.compile"
] | [((733, 779), 're.compile', 're.compile', (['"""[\\\\.,,。“”](无|未|未见)([一-龘、]+)[,。,]"""'], {}), "('[\\\\.,,。“”](无|未|未见)([一-龘、]+)[,。,]')\n", (743, 779), False, 'import re\n'), ((803, 822), 're.compile', 're.compile', (['"""[、及与]"""'], {}), "('[、及与]')\n", (813, 822), False, 'import re\n'), ((15430, 15488), 'knowledge_graph... |
# Generated by Django 3.1 on 2020-08-27 09:00
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("verification", "0014_auto_20200813_1415"),
]
operations = [
migrations.AddField(
model_name="companyverification",
nam... | [
"django.db.models.CharField"
] | [((363, 451), 'django.db.models.CharField', 'models.CharField', ([], {'blank': '(True)', 'max_length': '(128)', 'null': '(True)', 'verbose_name': '"""Postal code"""'}), "(blank=True, max_length=128, null=True, verbose_name=\n 'Postal code')\n", (379, 451), False, 'from django.db import migrations, models\n'), ((617,... |
#!/usr/bin/env python3
import re
import sys
import logging
import os
import ngram
from datetime import datetime
from gensim.models import Word2Vec
def debug(msg):
sys.stderr.write("{0}: {1}\n".format(str(datetime.now()), msg))
if __name__ == "__main__":
dataFile = sys.argv[1]
modelFile = sys.argv[2]
#Factore... | [
"datetime.datetime.now",
"ngram.SentenceNgramSampler",
"gensim.models.Word2Vec",
"logging.basicConfig"
] | [((537, 576), 'logging.basicConfig', 'logging.basicConfig', ([], {'level': 'logging.INFO'}), '(level=logging.INFO)\n', (556, 576), False, 'import logging\n'), ((589, 857), 'ngram.SentenceNgramSampler', 'ngram.SentenceNgramSampler', (['dataFile'], {'minCounts': 'freqFilter', 'tokFactor': 'tokFactor', 'posFactor': 'posFa... |
#===============================================================================#
# #
# rmem executable model #
# ===================== ... | [
"argparse.ArgumentParser",
"sys.exit"
] | [((2283, 2308), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (2306, 2308), False, 'import argparse\n'), ((2745, 2756), 'sys.exit', 'sys.exit', (['(0)'], {}), '(0)\n', (2753, 2756), False, 'import sys\n')] |
from __future__ import absolute_import
from __future__ import print_function
import numpy as np
import random
from keras.utils import np_utils
from keras.datasets import mnist
from keras.models import Model,Sequential
from keras.layers import Input, Flatten, Dense, Dropout, Lambda, concatenate, Add
from keras.optimize... | [
"keras.layers.Dropout",
"keras.backend.epsilon",
"keras.models.Model",
"keras.backend.square",
"keras.optimizers.RMSprop",
"keras.utils.np_utils.to_categorical",
"keras.callbacks.TensorBoard",
"numpy.array",
"numpy.mean",
"keras.layers.Lambda",
"keras.layers.Dense",
"keras.layers.Input",
"nu... | [((7099, 7116), 'numpy.array', 'np.array', (['x_train'], {}), '(x_train)\n', (7107, 7116), True, 'import numpy as np\n'), ((7126, 7142), 'numpy.array', 'np.array', (['x_test'], {}), '(x_test)\n', (7134, 7142), True, 'import numpy as np\n'), ((7248, 7265), 'numpy.array', 'np.array', (['y_train'], {}), '(y_train)\n', (72... |
from eulerlib import sumDigits
from time import time
import math
start = time()
a = [None]
##count = 0
##num = 10
##while len(a) <= 30:
## base = sumDigits(num)
## power = base
## if power > 1:
## while power <= num:
## power *= base
## if power == num:
## count +... | [
"eulerlib.sumDigits",
"time.time"
] | [((74, 80), 'time.time', 'time', ([], {}), '()\n', (78, 80), False, 'from time import time\n'), ((1044, 1050), 'time.time', 'time', ([], {}), '()\n', (1048, 1050), False, 'from time import time\n'), ((816, 830), 'eulerlib.sumDigits', 'sumDigits', (['num'], {}), '(num)\n', (825, 830), False, 'from eulerlib import sumDig... |
# Copyright 2006 <NAME> and contributors
# Copyright (C) 2009 <NAME> <<EMAIL>>
#
# 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 re... | [
"pyjamas.DOM.eventGetToElement",
"pyjamas.DOM.eventGetType",
"pyjamas.DOM.eventGetMouseWheelVelocityY",
"pyjamas.DOM.eventGetClientY",
"pyjamas.DOM.eventGetClientX",
"pyjamas.DOM.eventPreventDefault"
] | [((937, 960), 'pyjamas.DOM.eventGetType', 'DOM.eventGetType', (['event'], {}), '(event)\n', (953, 960), False, 'from pyjamas import DOM\n'), ((777, 803), 'pyjamas.DOM.eventGetClientX', 'DOM.eventGetClientX', (['event'], {}), '(event)\n', (796, 803), False, 'from pyjamas import DOM\n'), ((855, 881), 'pyjamas.DOM.eventGe... |
#!/usr/bin/env python
# This file is part of tcollector.
# Copyright (C) 2011 StumbleUpon, Inc.
#
# This program is free software: you can redistribute it and/or modify it
# under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation, either version 3 of the License, or (at ... | [
"os.getppid",
"resource.getpagesize",
"re.match",
"os.setuid",
"time.sleep",
"sys.stdin.close",
"time.time",
"os.getuid",
"sys.stdout.flush",
"io.open",
"pwd.getpwnam",
"os.setgid",
"sys.exit",
"re.compile"
] | [((4333, 4354), 'os.setgid', 'os.setgid', (['ent.pw_gid'], {}), '(ent.pw_gid)\n', (4342, 4354), False, 'import os\n'), ((4359, 4380), 'os.setuid', 'os.setuid', (['ent.pw_uid'], {}), '(ent.pw_uid)\n', (4368, 4380), False, 'import os\n'), ((4441, 4458), 'sys.stdin.close', 'sys.stdin.close', ([], {}), '()\n', (4456, 4458)... |
# Copyright 2017 Google 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 writing,... | [
"copy.copy"
] | [((2153, 2176), 'copy.copy', 'copy.copy', (['special.init'], {}), '(special.init)\n', (2162, 2176), False, 'import copy\n')] |
from django.core import paginator
from django.http import Http404
from django.shortcuts import redirect, render
from django.contrib.auth.models import User
from django.contrib.auth import authenticate, login, logout
from academy_app.models import CourseLectures, Courses, Curriculum, Enroll, Payment, PaymentDetail
from ... | [
"django.core.paginator.page",
"academy_app.models.Courses.objects.get",
"academy_app.models.Enroll",
"academy_app.models.PaymentDetail",
"django.contrib.auth.models.User.objects.create_user",
"django.contrib.auth.login",
"django.contrib.auth.decorators.login_required",
"django.contrib.auth.models.User... | [((2708, 2742), 'django.contrib.auth.decorators.login_required', 'login_required', ([], {'login_url': '"""/login"""'}), "(login_url='/login')\n", (2722, 2742), False, 'from django.contrib.auth.decorators import login_required\n'), ((2904, 2934), 'django.views.decorators.http.require_http_methods', 'require_http_methods... |
import gym
import numpy as np
import pygame
from pygame.locals import *
import time
import sys
sys.path.append('../')
ENV_NAME = 'PlaygroundNavigationHuman-v1'
from src.playground_env.reward_function import sample_descriptions_from_state, get_reward_from_state
from src.playground_env.descriptions import generate_all_... | [
"sys.path.append",
"src.playground_env.reward_function.get_reward_from_state",
"gym.make",
"src.playground_env.reward_function.sample_descriptions_from_state",
"pygame.event.get",
"numpy.zeros",
"pygame.init",
"src.playground_env.descriptions.generate_all_descriptions",
"time.sleep",
"numpy.random... | [((96, 118), 'sys.path.append', 'sys.path.append', (['"""../"""'], {}), "('../')\n", (111, 118), False, 'import sys\n'), ((494, 559), 'gym.make', 'gym.make', (['ENV_NAME'], {'reward_screen': '(False)', 'viz_data_collection': '(True)'}), '(ENV_NAME, reward_screen=False, viz_data_collection=True)\n', (502, 559), False, '... |
from django.contrib import admin
from .models import (
Lesson,
Code,
Attempt,
)
# Register your models here.
class LessonAdmin(admin.ModelAdmin):
fields = ['title', 'topic', 'description', 'difficulty']
admin.site.register(Lesson, LessonAdmin)
class CodeAdmin(admin.ModelAdmin):
fields = ['les... | [
"django.contrib.admin.site.register"
] | [((224, 264), 'django.contrib.admin.site.register', 'admin.site.register', (['Lesson', 'LessonAdmin'], {}), '(Lesson, LessonAdmin)\n', (243, 264), False, 'from django.contrib import admin\n'), ((348, 384), 'django.contrib.admin.site.register', 'admin.site.register', (['Code', 'CodeAdmin'], {}), '(Code, CodeAdmin)\n', (... |
from ..store import dir_path as store_dir
from ....share.scraper.pickle_utils import retrieve_pickle, store_as_pickle
from functools import partial
__all__ = ["retrieve_pickle", "store_as_pickle"]
retrieve_pickle = partial(retrieve_pickle, pickle_dir=store_dir)
store_as_pickle = partial(store_as_pickle, pickle_dir=st... | [
"functools.partial"
] | [((217, 263), 'functools.partial', 'partial', (['retrieve_pickle'], {'pickle_dir': 'store_dir'}), '(retrieve_pickle, pickle_dir=store_dir)\n', (224, 263), False, 'from functools import partial\n'), ((282, 328), 'functools.partial', 'partial', (['store_as_pickle'], {'pickle_dir': 'store_dir'}), '(store_as_pickle, pickle... |
#%%
import argparse
import os
import tempfile
import mlflow
import mlflow.pytorch
import numpy as np
import optuna
import pandas as pd
import torch
import torch.optim as optim
import torch.utils.data as data
import yaml
from dlkit import models
from dlkit.criterions import Criterion
from estimator impo... | [
"yaml.load",
"argparse.ArgumentParser",
"utils.geometry.project_onto_plane",
"mlflow.get_artifact_uri",
"torch.nn.CosineSimilarity",
"utils.modules.line_notify",
"utils.transformer.ScaleTransformer",
"mlflow.log_artifacts",
"torchvision.transforms.Normalize",
"dlkit.criterions.Criterion",
"panda... | [((12313, 12387), 'utils.dataloader.NpLaparoDataset', 'NpLaparoDataset', ([], {'phase': '"""train"""', 'ds_num': 'cfg.ds_num', 'input_size': 'resize_shape'}), "(phase='train', ds_num=cfg.ds_num, input_size=resize_shape)\n", (12328, 12387), False, 'from utils.dataloader import NpLaparoDataset\n'), ((12398, 12470), 'util... |
#!/usr/bin/env python
# from datetime import datetime
from ispyb_api.core import core
from ispyb_api.dbconnection import dbconnection
from ispyb_api.tomo import tomo
def store_dc(cursor, parentid):
"""Populate dict and store tomography datacollection"""
params = tomo.get_dc_params()
params["parentid"] =... | [
"ispyb_api.core.core.retrieve_visit_id",
"ispyb_api.dbconnection.dbconnection.connect_to_prod",
"ispyb_api.dbconnection.dbconnection.disconnect",
"ispyb_api.tomo.tomo.get_dc_params",
"ispyb_api.tomo.tomo.get_recon_params"
] | [((1612, 1642), 'ispyb_api.dbconnection.dbconnection.connect_to_prod', 'dbconnection.connect_to_prod', ([], {}), '()\n', (1640, 1642), False, 'from ispyb_api.dbconnection import dbconnection\n'), ((1655, 1697), 'ispyb_api.core.core.retrieve_visit_id', 'core.retrieve_visit_id', (['cursor', '"""ee9478-1"""'], {}), "(curs... |
import torchvision
if __name__ == "__main__":
root = './'
trainset = torchvision.datasets.MNIST(
root=root,
train=True,
download=True,
)
testset = torchvision.datasets.MNIST(
root=root,
train=False,
download=True,
)
| [
"torchvision.datasets.MNIST"
] | [((78, 142), 'torchvision.datasets.MNIST', 'torchvision.datasets.MNIST', ([], {'root': 'root', 'train': '(True)', 'download': '(True)'}), '(root=root, train=True, download=True)\n', (104, 142), False, 'import torchvision\n'), ((189, 254), 'torchvision.datasets.MNIST', 'torchvision.datasets.MNIST', ([], {'root': 'root',... |
"""
.. module: swag_api.common.health
:platform: Unix
:copyright: (c) 2019 by Netflix Inc., see AUTHORS for more
:license: Apache, see LICENSE for more details.
.. moduleauthor:: <NAME> <<EMAIL>>
.. moduleauthor:: <NAME> <<EMAIL>>
"""
from flask import Blueprint, g, request
from swag_api.extensions import s... | [
"flask.Blueprint",
"swag_api.extensions.swag.health_check",
"flask.request.method.lower"
] | [((331, 365), 'flask.Blueprint', 'Blueprint', (['"""healthCheck"""', '__name__'], {}), "('healthCheck', __name__)\n", (340, 365), False, 'from flask import Blueprint, g, request\n'), ((527, 546), 'swag_api.extensions.swag.health_check', 'swag.health_check', ([], {}), '()\n', (544, 546), False, 'from swag_api.extensions... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
from django.conf import settings
import django.core.validators
class Migration(migrations.Migration):
dependencies = [
('comun', '0001_initial'),
migrations.swappable_dependency(s... | [
"django.db.models.OneToOneField",
"django.db.migrations.swappable_dependency",
"django.db.models.ManyToManyField",
"django.db.models.TimeField",
"django.db.models.AutoField",
"django.db.models.IntegerField",
"django.db.models.DateField",
"django.db.models.DateTimeField"
] | [((287, 344), 'django.db.migrations.swappable_dependency', 'migrations.swappable_dependency', (['settings.AUTH_USER_MODEL'], {}), '(settings.AUTH_USER_MODEL)\n', (318, 344), False, 'from django.db import migrations, models\n'), ((3407, 3474), 'django.db.models.OneToOneField', 'models.OneToOneField', ([], {'null': '(Tru... |
#!/usr/bin/env python3
import argparse
import re
def main():
parser = argparse.ArgumentParser(
description="Extract selected stanzas from ncbitaxon.owl"
)
parser.add_argument("input", type=str, help="The input ncbitaxon.owl file")
parser.add_argument("taxa", type=str, help="The TSV file listi... | [
"argparse.ArgumentParser",
"re.compile"
] | [((77, 164), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Extract selected stanzas from ncbitaxon.owl"""'}), "(description=\n 'Extract selected stanzas from ncbitaxon.owl')\n", (100, 164), False, 'import argparse\n'), ((582, 600), 're.compile', 're.compile', (['"""\\\\d+"""'], {}), ... |
import io
import struct
class Mzp:
MAGIC = b"mrgd00"
class EntryHeader:
HEADER_FORMAT = "<HHHH"
SECTOR_SIZE = 0x800
def __init__(self, data):
(self._sector_offset,
self._byte_offset,
self._size_sectors,
self._size_bytes) = struct.unp... | [
"io.BytesIO",
"struct.unpack",
"struct.pack"
] | [((1074, 1110), 'struct.unpack', 'struct.unpack', (['"""<6sH"""', 'raw_data[0:8]'], {}), "('<6sH', raw_data[0:8])\n", (1087, 1110), False, 'import struct\n'), ((1852, 1864), 'io.BytesIO', 'io.BytesIO', ([], {}), '()\n', (1862, 1864), False, 'import io\n'), ((1955, 1967), 'io.BytesIO', 'io.BytesIO', ([], {}), '()\n', (1... |
from ivy import ivy_module as im
from ivy.ivy_compiler import ivy_from_string
from ivy.tk_ui import new_ui
from ivy import ivy_utils as iu
from ivy import ivy_check as ick
prog = """#lang ivy1.5
type packet
object intf = {
action send(x:packet)
action recv(x:packet)
}
object spec = {
relation sent(X:pac... | [
"ivy.ivy_module.Module",
"ivy.ivy_check.check_module",
"ivy.ivy_utils.set_parameters",
"ivy.ivy_compiler.ivy_from_string"
] | [((558, 569), 'ivy.ivy_module.Module', 'im.Module', ([], {}), '()\n', (567, 569), True, 'from ivy import ivy_module as im\n'), ((575, 640), 'ivy.ivy_utils.set_parameters', 'iu.set_parameters', (["{'mode': 'induction', 'show_compiled': 'true'}"], {}), "({'mode': 'induction', 'show_compiled': 'true'})\n", (592, 640), Tru... |
#!/usr/bin/env python3
"""Reference for a website, in IEEE format"""
import dateutil.parser as dp
import pyperclip
import os
authors = []
while True:
author = input("Author: ")
if author == "":
break
authors.append(author)
title = input("Title: ")
url = input("URL: ")
publisher = input("Publisher: ... | [
"os.system",
"pyperclip.copy"
] | [((827, 875), 'os.system', 'os.system', (["('cls' if os.name == 'nt' else 'clear')"], {}), "('cls' if os.name == 'nt' else 'clear')\n", (836, 875), False, 'import os\n'), ((915, 934), 'pyperclip.copy', 'pyperclip.copy', (['msg'], {}), '(msg)\n', (929, 934), False, 'import pyperclip\n')] |
# File Manager (FM)
# For reading from, writing, or appending to files
# NonLocal Modules
import os
import hashlib
import pickle
# Returns all lines
# Must pass file ext along as path
def get_all(path):
with open(path, 'r') as f:
objects = f.readlines()
for i in range(0, len(objects)):
... | [
"os.remove",
"pickle.dump",
"os.makedirs",
"os.getcwd",
"os.path.isdir",
"os.path.exists",
"os.path.isfile",
"pickle.load",
"os.chdir",
"os.listdir"
] | [((2488, 2503), 'os.remove', 'os.remove', (['path'], {}), '(path)\n', (2497, 2503), False, 'import os\n'), ((2601, 2616), 'os.remove', 'os.remove', (['ndir'], {}), '(ndir)\n', (2610, 2616), False, 'import os\n'), ((2935, 2950), 'os.listdir', 'os.listdir', (['"""."""'], {}), "('.')\n", (2945, 2950), False, 'import os\n'... |
from discord.ext import commands as cmd
from .utils import checks
from .utils.converters import MemberID, ActionReason, BannedMember
from .utils.discord_search import choose_item
import arrow
from math import floor
from datetime import timedelta
from random import random
import arrow
from typing import Optional
class... | [
"discord.ext.commands.command",
"discord.ext.commands.BadArgument",
"random.random",
"arrow.utcnow",
"arrow.Arrow.strptime"
] | [((408, 465), 'discord.ext.commands.command', 'cmd.command', ([], {'name': '"""cookie"""', 'aliases': "['kookie', 'cookies']"}), "(name='cookie', aliases=['kookie', 'cookies'])\n", (419, 465), True, 'from discord.ext import commands as cmd\n'), ((2004, 2048), 'discord.ext.commands.command', 'cmd.command', ([], {'name':... |
# coding=utf-8
from __future__ import absolute_import, division, print_function
from torchvision import transforms
from data.data_list_image import Normalize
def get_transform(dataset, img_size):
if dataset in ['svhn2mnist', 'usps2mnist', 'mnist2usps']:
transform_source = transforms.Compose([
... | [
"torchvision.transforms.RandomHorizontalFlip",
"torchvision.transforms.Normalize",
"torchvision.transforms.ToTensor",
"data.data_list_image.Normalize",
"torchvision.transforms.RandomResizedCrop",
"torchvision.transforms.RandomCrop",
"torchvision.transforms.Resize"
] | [((323, 392), 'torchvision.transforms.RandomResizedCrop', 'transforms.RandomResizedCrop', (['(img_size, img_size)'], {'scale': '(0.75, 1.2)'}), '((img_size, img_size), scale=(0.75, 1.2))\n', (351, 392), False, 'from torchvision import transforms\n'), ((410, 431), 'torchvision.transforms.ToTensor', 'transforms.ToTensor'... |
from portality.dao import DomainObject
from portality.models.cache import Cache
import sys
import locale
from copy import deepcopy
class JournalArticle(DomainObject):
__type__ = 'journal,article'
__readonly__ = True # TODO actually heed this attribute in all DomainObject methods which modify data
@classm... | [
"copy.deepcopy",
"portality.models.cache.Cache.cache_site_statistics",
"locale.resetlocale",
"portality.models.cache.Cache.get_site_statistics",
"locale.setlocale"
] | [((404, 431), 'portality.models.cache.Cache.get_site_statistics', 'Cache.get_site_statistics', ([], {}), '()\n', (429, 431), False, 'from portality.models.cache import Cache\n'), ((2855, 2889), 'portality.models.cache.Cache.cache_site_statistics', 'Cache.cache_site_statistics', (['stats'], {}), '(stats)\n', (2882, 2889... |
# -- coding: utf-8 --
import numpy as np
from sklearn.model_selection import train_test_split
def load_data(file_path='/data/u.data'):
"""
加载movielens评分数据
:param file_path: ratings数据存储位置
:return: 评分对(uid, mid, rating)数组,用户数量,电影数量
"""
data = []
for line in open(file_path, 'r'):
arr ... | [
"sklearn.model_selection.train_test_split",
"numpy.max",
"numpy.array",
"numpy.unique"
] | [((467, 481), 'numpy.array', 'np.array', (['data'], {}), '(data)\n', (475, 481), True, 'import numpy as np\n'), ((795, 828), 'sklearn.model_selection.train_test_split', 'train_test_split', (['data', 'test_size'], {}), '(data, test_size)\n', (811, 828), False, 'from sklearn.model_selection import train_test_split\n'), (... |
from collections import defaultdict
import re
import numpy as np
import os
import configure
# Class Attribute that has variables: type, text, start, end
class Attribute:
def __init__(self, tag, text, start, end):
self.tag = tag
self.text = text
self.start = start
self.end = end
... | [
"os.path.join",
"re.finditer",
"collections.defaultdict",
"re.search",
"re.sub"
] | [((1036, 1053), 'collections.defaultdict', 'defaultdict', (['list'], {}), '(list)\n', (1047, 1053), False, 'from collections import defaultdict\n'), ((6712, 6741), 're.sub', 're.sub', (['"""\\\\s+"""', '""" """', 'new_text'], {}), "('\\\\s+', ' ', new_text)\n", (6718, 6741), False, 'import re\n'), ((6757, 6787), 're.su... |
import unittest
from unittest.mock import patch
import programytest.storage.engines as Engines
from programy.dialog.conversation import Conversation
from programy.dialog.question import Question
from programy.parser.pattern.match import Match
from programy.parser.pattern.matchcontext import MatchContext
from programy.p... | [
"programytest.client.TestClient",
"unittest.skipIf",
"programy.storage.stores.sql.dao.conversation.Match",
"programy.storage.stores.sql.engine.SQLStorageEngine",
"programy.storage.stores.sql.dao.conversation.MatchNode",
"programy.dialog.question.Question",
"programy.parser.pattern.nodes.word.PatternWord... | [((1299, 1358), 'unittest.skipIf', 'unittest.skipIf', (['(Engines.sql is False)', 'Engines.sql_disabled'], {}), '(Engines.sql is False, Engines.sql_disabled)\n', (1314, 1358), False, 'import unittest\n'), ((1609, 1668), 'unittest.skipIf', 'unittest.skipIf', (['(Engines.sql is False)', 'Engines.sql_disabled'], {}), '(En... |
import glob
import os
BNC_CONFIG = os.path.join(os.path.dirname(__file__), 'bnc.cfg')
class BaseBNC(object):
def get_config(self):
return BNC_CONFIG
def list_filenames(self, dir_name):
return sorted(glob.glob(os.path.join(dir_name, '*.xml')))
def get_genre(self, tree):
return tr... | [
"os.path.dirname",
"os.path.join"
] | [((49, 74), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (64, 74), False, 'import os\n'), ((237, 268), 'os.path.join', 'os.path.join', (['dir_name', '"""*.xml"""'], {}), "(dir_name, '*.xml')\n", (249, 268), False, 'import os\n')] |
"""empty message
Revision ID: c4a89e579e00
Revises: <PASSWORD>
Create Date: 2016-06-08 19:39:22.067943
"""
# revision identifiers, used by Alembic.
revision = 'c4a89e579e00'
down_revision = '<PASSWORD>'
from alembic import op
import sqlalchemy as sa
def upgrade():
### commands auto generated by Alembic - plea... | [
"alembic.op.drop_table",
"sqlalchemy.PrimaryKeyConstraint",
"sqlalchemy.Text",
"sqlalchemy.ForeignKeyConstraint",
"sqlalchemy.Integer"
] | [((835, 855), 'alembic.op.drop_table', 'op.drop_table', (['"""tou"""'], {}), "('tou')\n", (848, 855), False, 'from alembic import op\n'), ((588, 639), 'sqlalchemy.ForeignKeyConstraint', 'sa.ForeignKeyConstraint', (["['audit_id']", "['audit.id']"], {}), "(['audit_id'], ['audit.id'])\n", (611, 639), True, 'import sqlalch... |
#
# Copyright 2012-2014 <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 to in writing, so... | [
"multigtfs.models.base.models.PointField",
"multigtfs.models.base.models.CharField",
"multigtfs.models.base.models.FloatField",
"jsonfield.JSONField",
"multigtfs.models.base.models.LineStringField",
"django.dispatch.receiver",
"django.contrib.gis.geos.LineString",
"multigtfs.models.base.models.Foreign... | [((4352, 4427), 'django.dispatch.receiver', 'receiver', (['post_save'], {'sender': 'ShapePoint', 'dispatch_uid': '"""post_save_shapepoint"""'}), "(post_save, sender=ShapePoint, dispatch_uid='post_save_shapepoint')\n", (4360, 4427), False, 'from django.dispatch import receiver\n'), ((1046, 1097), 'multigtfs.models.base.... |
from chainer.serializers import npz
from chainer.training import extension
from chainer.training.extensions._snapshot import _snapshot_object
from chainer.training import trigger as trigger_module
from chainer.training.triggers import IntervalTrigger
import six
from chainerui.utils.command_item import CommandItem
from... | [
"chainerui.utils.command_item.CommandItem.dump_commands",
"chainerui.utils.command_item.CommandItem.load_commands",
"chainer.training.trigger.get_trigger",
"chainerui.utils.command_item.CommandItem.remove_commands_file",
"chainerui.utils.commands_state.CommandsState.stop",
"chainerui.utils.commands_state.... | [((1046, 1079), 'six.iteritems', 'six.iteritems', (['request_hyperparam'], {}), '(request_hyperparam)\n', (1059, 1079), False, 'import six\n'), ((3627, 3662), 'chainer.training.trigger.get_trigger', 'trigger_module.get_trigger', (['trigger'], {}), '(trigger)\n', (3653, 3662), True, 'from chainer.training import trigger... |
# coding=utf-8
import datetime
from pprint import pprint
from string import punctuation
import os
import random
import re
import yaml
from adapt.intent import IntentBuilder
from adapt.engine import IntentDeterminationEngine
from chronyk import chronyk
from dateparser import parse
from zentropi import Agent, Frame, KIN... | [
"os.path.abspath",
"zentropi.utils.run_agents_forever",
"chronyk.chronyk.Chronyk",
"zentropi.on_event",
"zentropi.handlers.HandlerRegistry",
"nltk.corpus.wordnet.synsets",
"zentropi.handlers.Handler",
"random.choice",
"datetime.datetime.now",
"pprint.pprint",
"dateparser.parse",
"zentropi.on_m... | [((8410, 8447), 'zentropi.utils.run_agents_forever', 'run_agents_forever', (['agent'], {'shell': '(True)'}), '(agent, shell=True)\n', (8428, 8447), False, 'from zentropi.utils import StopAgent, run_agents_forever\n'), ((1551, 1578), 'adapt.engine.IntentDeterminationEngine', 'IntentDeterminationEngine', ([], {}), '()\n'... |
import os
import shutil
import sys
dirs = list(sys.argv[1:])
s, e = len('epoch_'), -len('.pth')
while len(dirs) != 0:
the_dir = dirs.pop(0)
epoch_fpath_map = {}
for f in os.listdir(the_dir):
fpath = os.path.join(the_dir, f)
if os.path.isdir(fpath):
dirs.append(fpath)
el... | [
"os.path.isdir",
"os.remove",
"os.path.join",
"os.listdir"
] | [((184, 203), 'os.listdir', 'os.listdir', (['the_dir'], {}), '(the_dir)\n', (194, 203), False, 'import os\n'), ((221, 245), 'os.path.join', 'os.path.join', (['the_dir', 'f'], {}), '(the_dir, f)\n', (233, 245), False, 'import os\n'), ((257, 277), 'os.path.isdir', 'os.path.isdir', (['fpath'], {}), '(fpath)\n', (270, 277)... |
import io
import os
import logging
import boto3
import random
logger = logging.getLogger()
logger.setLevel(logging.INFO)
def handler(event, context):
logger.info(event)
# Load event variables
logs_input_bucket = event['cloudtrail_bucket']
logs_input_prefix = event['cloudtrail_key']
logs_aws_accoun... | [
"boto3.session.Session",
"logging.getLogger",
"boto3.client"
] | [((72, 91), 'logging.getLogger', 'logging.getLogger', ([], {}), '()\n', (89, 91), False, 'import logging\n'), ((735, 754), 'boto3.client', 'boto3.client', (['"""sns"""'], {}), "('sns')\n", (747, 754), False, 'import boto3\n'), ((820, 843), 'boto3.session.Session', 'boto3.session.Session', ([], {}), '()\n', (841, 843), ... |
import mailbox
import os
import time
import unittest
from test import test_support
# cleanup earlier tests
try:
os.unlink(test_support.TESTFN)
except os.error:
pass
DUMMY_MESSAGE = """\
From: <EMAIL>
To: <EMAIL>
This is a dummy message.
"""
class MaildirTestCase(unittest.TestCase):
def setUp(self):
... | [
"os.mkdir",
"os.unlink",
"time.time",
"test.test_support.run_unittest",
"os.link",
"os.rmdir",
"os.path.join",
"mailbox.Maildir"
] | [((117, 147), 'os.unlink', 'os.unlink', (['test_support.TESTFN'], {}), '(test_support.TESTFN)\n', (126, 147), False, 'import os\n'), ((3102, 3144), 'test.test_support.run_unittest', 'test_support.run_unittest', (['MaildirTestCase'], {}), '(MaildirTestCase)\n', (3127, 3144), False, 'from test import test_support\n'), ((... |
import abc
import logging
import os
import subprocess as sp
from collections import OrderedDict
from enum import Enum
from .simulation import Simulation
logger = logging.getLogger(__name__)
class AMBER(Simulation, abc.ABC):
"""
A wrapper for setting parameters and running MD with AMBER.
"""
class T... | [
"subprocess.Popen",
"os.path.isfile",
"collections.OrderedDict",
"os.path.join",
"logging.getLogger"
] | [((164, 191), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (181, 191), False, 'import logging\n'), ((7897, 7910), 'collections.OrderedDict', 'OrderedDict', ([], {}), '()\n', (7908, 7910), False, 'from collections import OrderedDict\n'), ((25612, 25639), 'os.path.isfile', 'os.path.isfile... |
#!/usr/bin/env python
# Created Time: Thu 19 Jul 2018 09:13:02 PM CST
# Author: <NAME> <<EMAIL>>
import subprocess
from config import cfg
model_urls = {
'resnet50': 'https://download.pytorch.org/models/resnet50-19c8e357.pth',
'vgg16': 'https://download.pytorch.org/models/vgg16-397923af.pth',
}
for model_name... | [
"subprocess.call"
] | [((470, 502), 'subprocess.call', 'subprocess.call', (['cmd'], {'shell': '(True)'}), '(cmd, shell=True)\n', (485, 502), False, 'import subprocess\n')] |