code stringlengths 22 1.05M | apis listlengths 1 3.31k | extract_api stringlengths 75 3.25M |
|---|---|---|
'''Basic socket example'''
import socket
SERVER_ADDR = input("What server do you want to connect to? ")
SOCK = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
SOCK.connect((SERVER_ADDR, 80))
SOCK.send(b"GET / HTTP/1.1\r\nHost: " +
bytes(SERVER_ADDR, "utf8") +
b"\r\nConnection: close\r\n\r\n")
RE... | [
"socket.socket"
] | [((113, 162), 'socket.socket', 'socket.socket', (['socket.AF_INET', 'socket.SOCK_STREAM'], {}), '(socket.AF_INET, socket.SOCK_STREAM)\n', (126, 162), False, 'import socket\n')] |
from setuptools import setup, find_packages
install_requires = [
'bottle'
]
setup(
name='appname',
version='0.1.0',
packages=find_packages(),
package_data={ '': ['*.html'] },
entry_points={
'console_scripts': [ 'appname=appname.__main__:main' ]
},
install_requires=install_requ... | [
"setuptools.find_packages"
] | [((144, 159), 'setuptools.find_packages', 'find_packages', ([], {}), '()\n', (157, 159), False, 'from setuptools import setup, find_packages\n')] |
import cv2
from geosolver.diagram.draw_on_image import draw_point, draw_instance, draw_label
from geosolver.ontology.ontology_semantics import evaluate
from geosolver.utils.prep import display_image
__author__ = 'minjoon'
class ImageSegment(object):
def __init__(self, segmented_image, sliced_image, binarized_se... | [
"geosolver.ontology.ontology_semantics.evaluate",
"geosolver.diagram.draw_on_image.draw_point",
"geosolver.utils.prep.display_image",
"cv2.cvtColor",
"geosolver.diagram.draw_on_image.draw_instance",
"geosolver.diagram.draw_on_image.draw_label"
] | [((768, 816), 'geosolver.utils.prep.display_image', 'display_image', (['self.segmented_image'], {'block': 'block'}), '(self.segmented_image, block=block)\n', (781, 816), False, 'from geosolver.utils.prep import display_image\n'), ((887, 945), 'geosolver.utils.prep.display_image', 'display_image', (['self.binarized_segm... |
from django.urls import include, path
from rest_framework import routers
from . import views
router = routers.DefaultRouter()
router.register(r"", views.AnalysisViewSet, basename="Analysis")
urlpatterns = [path("v1/analysis/", include(router.urls))]
| [
"rest_framework.routers.DefaultRouter",
"django.urls.include"
] | [((103, 126), 'rest_framework.routers.DefaultRouter', 'routers.DefaultRouter', ([], {}), '()\n', (124, 126), False, 'from rest_framework import routers\n'), ((229, 249), 'django.urls.include', 'include', (['router.urls'], {}), '(router.urls)\n', (236, 249), False, 'from django.urls import include, path\n')] |
#! /usr/bin/env python
# -*- coding: utf-8 -*-
# Pocket PiAP
# ......................................................................
# Copyright (c) 2017-2020, <NAME>
# ......................................................................
# Licensed under MIT (the "License");
# you may not use this file except in co... | [
"book.logs.logs.log",
"context.unittest.main",
"context.unittest.skipUnless",
"book.logs.logs",
"book.logs.logs.main"
] | [((2140, 2211), 'context.unittest.skipUnless', 'unittest.skipUnless', (['(sys.version_info >= (3, 4))', '"""Requires Python 3.4+"""'], {}), "(sys.version_info >= (3, 4), 'Requires Python 3.4+')\n", (2159, 2211), True, 'from context import unittest as unittest\n'), ((2907, 2978), 'context.unittest.skipUnless', 'unittest... |
"""
Author: <NAME>
Since: 2019-12
"""
import json
import querybuilder as qb
import importlib
importlib.reload(qb)
with open('./config.json', 'rb') as file:
CONFIG = json.load(fp=file)
SAFRAS = ['201901']
QUERY_DICT = CONFIG["123456"]
print(qb.ConfigQueryReader(SAFRAS, QUERY_DICT)\
.build())
| [
"json.load",
"querybuilder.ConfigQueryReader",
"importlib.reload"
] | [((94, 114), 'importlib.reload', 'importlib.reload', (['qb'], {}), '(qb)\n', (110, 114), False, 'import importlib\n'), ((170, 188), 'json.load', 'json.load', ([], {'fp': 'file'}), '(fp=file)\n', (179, 188), False, 'import json\n'), ((247, 287), 'querybuilder.ConfigQueryReader', 'qb.ConfigQueryReader', (['SAFRAS', 'QUER... |
import dataclasses
@dataclasses.dataclass
class User:
name: str
features: list = dataclasses.field(default_factory=list)
| [
"dataclasses.field"
] | [((91, 130), 'dataclasses.field', 'dataclasses.field', ([], {'default_factory': 'list'}), '(default_factory=list)\n', (108, 130), False, 'import dataclasses\n')] |
"""
Work with analyses in the database.
"""
import asyncio
from typing import Any, Dict, List, Optional, Tuple
import virtool.bio
import virtool.db.utils
import virtool.utils
from virtool.config.cls import Config
from virtool.indexes.db import get_current_id_and_version
from virtool.subtractions.db import attach_subt... | [
"virtool.subtractions.db.attach_subtractions",
"virtool.indexes.db.get_current_id_and_version",
"virtool.users.db.attach_user",
"asyncio.sleep"
] | [((3165, 3198), 'virtool.subtractions.db.attach_subtractions', 'attach_subtractions', (['db', 'document'], {}), '(db, document)\n', (3184, 3198), False, 'from virtool.subtractions.db import attach_subtractions\n'), ((3221, 3247), 'virtool.users.db.attach_user', 'attach_user', (['db', 'processed'], {}), '(db, processed)... |
import typing
import numpy as np
def find_divisors(
n: int,
) -> np.array:
i = np.arange(int(n ** .5))
i += 1
i = i[n % i == 0]
i = np.hstack((i, n // i))
return np.unique(i)
def gpf(
n: int = 1 << 20,
) -> np.array:
s = np.arange(n)
s[:2] = -1
i = 0
while i * i < n - 1:
i += 1
if s... | [
"numpy.unique",
"numpy.hstack",
"numpy.flatnonzero",
"numba.njit",
"numba.pycc.CC",
"my_module.solve",
"numpy.arange"
] | [((146, 168), 'numpy.hstack', 'np.hstack', (['(i, n // i)'], {}), '((i, n // i))\n', (155, 168), True, 'import numpy as np\n'), ((178, 190), 'numpy.unique', 'np.unique', (['i'], {}), '(i)\n', (187, 190), True, 'import numpy as np\n'), ((244, 256), 'numpy.arange', 'np.arange', (['n'], {}), '(n)\n', (253, 256), True, 'im... |
# coding: utf-8
"""List of classes aiming to extract information from a history OSM data
file. This information deals with OSM element history, or tag genome
history. Other extracts are possible, however we let these developments for
further investigations.
"""
import pandas as pd
import osmium as osm
#####
DEFAUL... | [
"pandas.Timestamp",
"osmium.SimpleHandler.__init__"
] | [((330, 366), 'pandas.Timestamp', 'pd.Timestamp', (['"""2000-01-01T00:00:00Z"""'], {}), "('2000-01-01T00:00:00Z')\n", (342, 366), True, 'import pandas as pd\n'), ((782, 814), 'osmium.SimpleHandler.__init__', 'osm.SimpleHandler.__init__', (['self'], {}), '(self)\n', (808, 814), True, 'import osmium as osm\n'), ((2238, 2... |
import re
from django.db import models
from django.utils.translation import ugettext_lazy as _
from cms.models import CMSPlugin
from os.path import basename
class Video(CMSPlugin):
CLICK_TARGET_BLANK = '_blank'
CLICK_TARGET_SELF = '_self'
CLICK_TARGET_PARENT = '_parent'
WMODE_WINDOW = 'window'
... | [
"django.utils.translation.ugettext_lazy",
"re.match",
"os.path.basename"
] | [((754, 764), 'django.utils.translation.ugettext_lazy', '_', (['"""movie"""'], {}), "('movie')\n", (755, 764), True, 'from django.utils.translation import ugettext_lazy as _\n'), ((861, 871), 'django.utils.translation.ugettext_lazy', '_', (['"""image"""'], {}), "('image')\n", (862, 871), True, 'from django.utils.transl... |
from utils import logger_utils
from utils.enums.status import Status
class Blueprint(object):
def __init__(self, name, b_type):
self.name = name
self.type = b_type
def to_dict(self):
return {
"NAME": self.name,
"TYPE": self.type
}
def __str__(self... | [
"utils.logger_utils.get_logger"
] | [((592, 625), 'utils.logger_utils.get_logger', 'logger_utils.get_logger', (['__name__'], {}), '(__name__)\n', (615, 625), False, 'from utils import logger_utils\n')] |
#!/usr/bin/env python3
import sys, os, re, math, copy
import numpy as np
import matplotlib.pyplot as plt
from matplotlib.patches import Circle, PathPatch
# import the Python wrapper
from dubinswrapper import DubinsWrapper as dubins
################################################
# Scenarios
########################... | [
"dubinswrapper.DubinsWrapper.shortest_path_GDIP",
"dubinswrapper.DubinsWrapper.shortest_path",
"os.makedirs",
"matplotlib.pyplot.gca",
"matplotlib.pyplot.plot",
"math.sqrt",
"matplotlib.pyplot.clf",
"matplotlib.pyplot.axis",
"math.cos",
"numpy.array",
"numpy.zeros",
"numpy.argmin",
"numpy.mi... | [((971, 1007), 'os.makedirs', 'os.makedirs', (['"""images"""'], {'exist_ok': '(True)'}), "('images', exist_ok=True)\n", (982, 1007), False, 'import sys, os, re, math, copy\n'), ((1477, 1506), 'matplotlib.pyplot.plot', 'plt.plot', (['x_val', 'y_val', 'specs'], {}), '(x_val, y_val, specs)\n', (1485, 1506), True, 'import ... |
from __future__ import print_function
from __future__ import division
from __future__ import unicode_literals
from __future__ import absolute_import
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.cm as cm
from matplotlib import gridspec
from kcsd import csd_profile as CSD
from kcsd import Validat... | [
"numpy.mean",
"numpy.abs",
"matplotlib.pyplot.savefig",
"matplotlib.pyplot.colorbar",
"kCSD_with_reliability_map_2D.make_reconstruction",
"kCSD_with_reliability_map_2D.matrix_symmetrization",
"numpy.linspace",
"matplotlib.pyplot.figure",
"matplotlib.gridspec.GridSpec",
"numpy.zeros",
"matplotlib... | [((2030, 2067), 'numpy.linspace', 'np.linspace', (['(0)', '(0.2)', '(3)'], {'endpoint': '(True)'}), '(0, 0.2, 3, endpoint=True)\n', (2041, 2067), True, 'import numpy as np\n'), ((2072, 2151), 'matplotlib.pyplot.colorbar', 'plt.colorbar', (['im'], {'cax': 'cax', 'orientation': '"""horizontal"""', 'format': '"""%.2f"""',... |
import taos
import logging
import functools
from taostd import cache
from datetime import datetime, timedelta
from taostd.model import TDCtx, TDError, Engine, ConnectionCtx, Dict, MultiColumnsError
from taostd.bind import bind_params, batch_bind_params
from taostd.sql import get_sql_tags, get_sql_values, get_insert_sql... | [
"taostd.model.MultiColumnsError",
"logging.debug",
"taostd.sql.get_insert_sql",
"taostd.sql.get_sql_values",
"copy.deepcopy",
"taostd.cache.delete",
"datetime.timedelta",
"logging.info",
"taostd.model.ConnectionCtx",
"logging.error",
"taostd.sql.get_sql_tags",
"taostd.cache.get",
"taostd.mod... | [((783, 807), 'queue.Queue', 'Queue', ([], {'maxsize': 'pool_size'}), '(maxsize=pool_size)\n', (788, 807), False, 'from queue import Queue\n'), ((896, 908), 'taostd.model.TDCtx', 'TDCtx', (['_pool'], {}), '(_pool)\n', (901, 908), False, 'from taostd.model import TDCtx, TDError, Engine, ConnectionCtx, Dict, MultiColumns... |
'''
[LICENSE]
Copyright (c) 2017, Alliance for Sustainable Energy.
All rights reserved.
Redistribution and use in source and binary forms,
with or without modification, are permitted provided
that the following conditions are met:
1. Redistributions of source code must retain the above
copyright notice, this list... | [
"logging.getLogger",
"collections.OrderedDict",
"gdxpds.gdx.GdxFile"
] | [((1837, 1864), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (1854, 1864), False, 'import logging\n'), ((1976, 2023), 'gdxpds.gdx.GdxFile', 'GdxFile', ([], {'gams_dir': 'gams_dir', 'lazy_load': 'lazy_load'}), '(gams_dir=gams_dir, lazy_load=lazy_load)\n', (1983, 2023), False, 'from gdxpd... |
import factory
from faker import Faker
from src.association.tests.factories import ModelFactory
from src.customers.domain.entities import Customer
fake = Faker()
class CustomerFactory(ModelFactory):
class Meta:
model = Customer
user_id = factory.LazyAttribute(lambda _: fake.pyint(min_value=1, max_v... | [
"faker.Faker",
"factory.LazyAttribute"
] | [((156, 163), 'faker.Faker', 'Faker', ([], {}), '()\n', (161, 163), False, 'from faker import Faker\n'), ((357, 412), 'factory.LazyAttribute', 'factory.LazyAttribute', (["(lambda obj: f'cus_{obj.user_id}')"], {}), "(lambda obj: f'cus_{obj.user_id}')\n", (378, 412), False, 'import factory\n')] |
#!/usr/bin/env python
import argparse
import rospy
from nav_msgs.msg import Odometry
from tf.transformations import euler_from_quaternion, quaternion_from_euler
import os
import datetime
from sensor_msgs.msg import Image, CameraInfo, Imu, PointCloud2
from nav_msgs.msg import Odometry
from tf2_msgs.msg import TFMessage... | [
"rospy.logerr",
"argparse.ArgumentParser",
"rospy.logwarn",
"rospy.init_node",
"os.path.join",
"os.getcwd",
"rospy.Duration",
"datetime.datetime.now",
"datetime.timedelta",
"rospy.spin",
"message_filters.Subscriber",
"message_filters.ApproximateTimeSynchronizer",
"rospy.loginfo"
] | [((399, 478), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'formatter_class': 'argparse.ArgumentDefaultsHelpFormatter'}), '(formatter_class=argparse.ArgumentDefaultsHelpFormatter)\n', (422, 478), False, 'import argparse\n'), ((2631, 2654), 'datetime.datetime.now', 'datetime.datetime.now', ([], {}), '()\n... |
"""
@author: <NAME> <<EMAIL>>
"""
import os
import argparse
from torch.utils.data import DataLoader
import torch.nn as nn
import torch
from src.voc_dataset import VOCDataset
from src.utils import custom_collate_fn, multiple_losses, update_lr, get_optimizer
from src.deeplab import Deeplab
from tensorboardX import Summar... | [
"src.utils.get_optimizer",
"torch.utils.data.DataLoader",
"torch.cuda.is_available",
"src.utils.update_lr",
"tensorboardX.SummaryWriter",
"argparse.ArgumentParser",
"src.voc_dataset.VOCDataset",
"os.path.isdir",
"torch.Tensor",
"torch.save",
"torch.manual_seed",
"src.deeplab.Deeplab",
"os.ma... | [((373, 521), 'argparse.ArgumentParser', 'argparse.ArgumentParser', (['"""DeepLab: Semantic Image Segmentation with Deep Convolutional Nets, Atrous Convolution, and Fully Connected CRFs"""'], {}), "(\n 'DeepLab: Semantic Image Segmentation with Deep Convolutional Nets, Atrous Convolution, and Fully Connected CRFs'\n... |
import os, shutil, atexit
from trajectory import app as application
if __name__ == "__main__":
def app_atexit():
# remove all trajectory data
temp_dir = application.config.get('TEMP_DIR')
for file in os.listdir(temp_dir):
if os.path.isdir(os.path.join(temp_dir, file)):
... | [
"os.listdir",
"trajectory.app.config.get",
"os.path.join",
"atexit.register",
"trajectory.app.run"
] | [((417, 444), 'atexit.register', 'atexit.register', (['app_atexit'], {}), '(app_atexit)\n', (432, 444), False, 'import os, shutil, atexit\n'), ((449, 542), 'trajectory.app.run', 'application.run', ([], {'port': '(80)', 'host': '"""0.0.0.0"""', 'ssl_context': '"""adhoc"""', 'threaded': '(True)', 'debug': '(False)'}), "(... |
"""
# Copyright 2022 Red Hat
#
# 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 agr... | [
"cibyl.plugins.enable_plugins",
"cibyl.plugins.openstack.Plugin"
] | [((1443, 1451), 'cibyl.plugins.openstack.Plugin', 'Plugin', ([], {}), '()\n', (1449, 1451), False, 'from cibyl.plugins.openstack import Plugin\n'), ((1713, 1721), 'cibyl.plugins.openstack.Plugin', 'Plugin', ([], {}), '()\n', (1719, 1721), False, 'from cibyl.plugins.openstack import Plugin\n'), ((2012, 2020), 'cibyl.plu... |
"""
Custom integration to integrate DPC-Alert with Home Assistant.
For more details about this integration, please refer to
https://github.com/caiosweet/Home-Assistant-custom-components-DPC-Alert
"""
from __future__ import annotations
import asyncio
from datetime import timedelta
from homeassistant.config_entries im... | [
"homeassistant.helpers.event.async_call_later",
"homeassistant.helpers.update_coordinator.UpdateFailed",
"homeassistant.helpers.aiohttp_client.async_get_clientsession"
] | [((1739, 1768), 'homeassistant.helpers.aiohttp_client.async_get_clientsession', 'async_get_clientsession', (['hass'], {}), '(hass)\n', (1762, 1768), False, 'from homeassistant.helpers.aiohttp_client import async_get_clientsession\n'), ((3156, 3179), 'homeassistant.helpers.update_coordinator.UpdateFailed', 'UpdateFailed... |
import json
import requests
import os
webhook_url = os.environ['RELAY_WEBHOOK_URL']
def lambda_handler(event, context):
print(event)
response = requests.post(
webhook_url, data=json.dumps(event),
headers={'Content-Type': 'application/json'}
)
if response.status_code != 200:
ret... | [
"json.dumps"
] | [((195, 212), 'json.dumps', 'json.dumps', (['event'], {}), '(event)\n', (205, 212), False, 'import json\n'), ((394, 522), 'json.dumps', 'json.dumps', (['("""Request to webhook returned an error %s, the response is:\n%s""" % (\n response.status_code, response.text))'], {}), '(\n """Request to webhook returned an e... |
import logging
from logging import handlers
import re
from src.utils import config
import jieba
import json
from tqdm import tqdm
# jieba.enable_parallel(4)
import pandas as pd
import time
from functools import partial, wraps
from datetime import timedelta
tqdm.pandas()
def timethis(func=None, log=logging.getLogger(... | [
"logging.getLogger",
"jieba.lcut",
"logging.StreamHandler",
"pandas.read_csv",
"logging.Formatter",
"functools.wraps",
"logging.handlers.TimedRotatingFileHandler",
"functools.partial",
"pandas.concat",
"re.sub",
"tqdm.tqdm.pandas",
"time.time"
] | [((258, 271), 'tqdm.tqdm.pandas', 'tqdm.pandas', ([], {}), '()\n', (269, 271), False, 'from tqdm import tqdm\n'), ((302, 321), 'logging.getLogger', 'logging.getLogger', ([], {}), '()\n', (319, 321), False, 'import logging\n'), ((540, 551), 'functools.wraps', 'wraps', (['func'], {}), '(func)\n', (545, 551), False, 'from... |
import requests
from typing import List
from bs4 import BeautifulSoup
import http.cookiejar as cookielib
import numpy as np
import re
crawl_header = {"user-agent" : "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_0) AppleWebKit/535.11 (KHTML, like Gecko) Chrome/17.0.963.56 Safari/535.11"}
# 根据工资获取中间段
def get_midfix(sala... | [
"bs4.BeautifulSoup",
"numpy.sum",
"re.findall",
"requests.get"
] | [((2753, 2784), 'requests.get', 'requests.get', (['url', 'crawl_header'], {}), '(url, crawl_header)\n', (2765, 2784), False, 'import requests\n'), ((2796, 2830), 'bs4.BeautifulSoup', 'BeautifulSoup', (['web.content', '"""lxml"""'], {}), "(web.content, 'lxml')\n", (2809, 2830), False, 'from bs4 import BeautifulSoup\n'),... |
import pdb
from collections import namedtuple
from pathlib import Path
import z3
import sage.all
import helpers.vcommon as CM
from helpers.miscs import Miscs
import data.prog
import settings
DBG = pdb.set_trace
mlog = CM.getLogger(__name__, settings.logger_level)
class SymbsVals(namedtuple("SymbsVals", ("ss", "v... | [
"z3.And",
"collections.namedtuple",
"helpers.vcommon.getLogger",
"helpers.miscs.Miscs.is_expr",
"helpers.miscs.Miscs.rat2str",
"helpers.miscs.Miscs.get_vars"
] | [((223, 268), 'helpers.vcommon.getLogger', 'CM.getLogger', (['__name__', 'settings.logger_level'], {}), '(__name__, settings.logger_level)\n', (235, 268), True, 'import helpers.vcommon as CM\n'), ((287, 324), 'collections.namedtuple', 'namedtuple', (['"""SymbsVals"""', "('ss', 'vs')"], {}), "('SymbsVals', ('ss', 'vs'))... |
import unittest
from pprint import pprint
from typing import Optional
from dataclasses import dataclass
from xrpc.const import SERVER_SERDE_INST
from xrpc.serde.abstract import SerdeSet
from xrpc.serde.error import SerdeException
@dataclass
class ObjV1:
a: int
@dataclass
class ObjV2Err(ObjV1):
b: int
@d... | [
"xrpc.serde.abstract.SerdeSet.walk",
"pprint.pprint"
] | [((458, 497), 'xrpc.serde.abstract.SerdeSet.walk', 'SerdeSet.walk', (['SERVER_SERDE_INST', 'ObjV1'], {}), '(SERVER_SERDE_INST, ObjV1)\n', (471, 497), False, 'from xrpc.serde.abstract import SerdeSet\n'), ((756, 788), 'pprint.pprint', 'pprint', (['self.serde.deserializers'], {}), '(self.serde.deserializers)\n', (762, 78... |
#!/usr/bin/env python
# vim: set et sw=4 sts=4 fileencoding=utf-8:
#
# Copyright (c) 2013-2017 <NAME> <<EMAIL>>
# Copyright (c) 2013 Mime Consulting Ltd. <<EMAIL>>
# All rights reserved.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation file... | [
"setuptools.find_packages",
"os.path.join",
"codecs.register",
"os.path.dirname",
"codecs.lookup"
] | [((1864, 1889), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (1879, 1889), False, 'import os\n'), ((1964, 1985), 'codecs.lookup', 'codecs.lookup', (['"""mbcs"""'], {}), "('mbcs')\n", (1977, 1985), False, 'import codecs\n'), ((2018, 2040), 'codecs.lookup', 'codecs.lookup', (['"""ascii"""'], ... |
import webbrowser as wb
import tkinter
from tkinter import messagebox
window = tkinter.Tk()
window.title("Calculator")
btn_add = tkinter.Button(window, text="Addition", font=("Consolas", 12))
btn_add.pack(padx=10, pady=10)
count1 = 0
def click1(event):
global count1
count1 = count1 + 1
if c... | [
"webbrowser.get",
"tkinter.Tk",
"tkinter.messagebox.showinfo",
"tkinter.Button"
] | [((84, 96), 'tkinter.Tk', 'tkinter.Tk', ([], {}), '()\n', (94, 96), False, 'import tkinter\n'), ((136, 198), 'tkinter.Button', 'tkinter.Button', (['window'], {'text': '"""Addition"""', 'font': "('Consolas', 12)"}), "(window, text='Addition', font=('Consolas', 12))\n", (150, 198), False, 'import tkinter\n'), ((505, 570)... |
from flask_wtf import FlaskForm
from wtforms import StringField, PasswordField, SubmitField, BooleanField
from wtforms.validators import DataRequired, Length, Email, EqualTo
from wtforms_sqlalchemy.fields import QuerySelectField
from fellowcrm.settings.models import Currency, TimeZone
class NewSystemUser(FlaskForm):... | [
"wtforms.validators.Email",
"wtforms.BooleanField",
"wtforms.SubmitField",
"wtforms.validators.EqualTo",
"wtforms.validators.Length",
"wtforms.validators.DataRequired"
] | [((1272, 1314), 'wtforms.SubmitField', 'SubmitField', (['"""Next: Setup Company Details"""'], {}), "('Next: Setup Company Details')\n", (1283, 1314), False, 'from wtforms import StringField, PasswordField, SubmitField, BooleanField\n'), ((1887, 1927), 'wtforms.SubmitField', 'SubmitField', (['"""Next: Finish Installatio... |
import unittest
from sys import argv
from decocli.api import cli_class
from decocli.cli import CLI
from decocli.mbr.subcli import SubCLI
class TestPyCLI(unittest.TestCase):
def setUp(self):
a = argv
a.clear()
a.append('decoCLI.py')
CLI.clear()
CLI.set_param('--name', 'nam... | [
"decocli.mbr.subcli.SubCLI",
"decocli.cli.CLI.clear",
"decocli.cli.CLI.exec_seq",
"decocli.cli.CLI.exec",
"decocli.cli.CLI.set_cmd",
"decocli.cli.CLI.add_sub_cli",
"unittest.main",
"decocli.cli.CLI.set_param"
] | [((4943, 4958), 'unittest.main', 'unittest.main', ([], {}), '()\n', (4956, 4958), False, 'import unittest\n'), ((272, 283), 'decocli.cli.CLI.clear', 'CLI.clear', ([], {}), '()\n', (281, 283), False, 'from decocli.cli import CLI\n'), ((292, 326), 'decocli.cli.CLI.set_param', 'CLI.set_param', (['"""--name"""', '"""name""... |
"""
Django settings for bc project.
"""
import os
import sys
from wagtail.embeds.oembed_providers import youtube
import dj_database_url
import raven
from raven.exceptions import InvalidGitRepository
env = os.environ.copy()
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
PROJECT_DIR = os.pat... | [
"dj_database_url.config",
"os.path.join",
"os.environ.copy",
"os.path.dirname",
"os.path.abspath",
"logging.disable",
"raven.fetch_git_sha"
] | [((208, 225), 'os.environ.copy', 'os.environ.copy', ([], {}), '()\n', (223, 225), False, 'import os\n'), ((385, 413), 'os.path.dirname', 'os.path.dirname', (['PROJECT_DIR'], {}), '(PROJECT_DIR)\n', (400, 413), False, 'import os\n'), ((10090, 10122), 'os.path.join', 'os.path.join', (['BASE_DIR', '"""public"""'], {}), "(... |
"""Any function from n inputs to m outputs"""
import logging
from itertools import zip_longest
import pypes.component
log = logging.getLogger(__name__)
def default_function(*args):
"pass"
return args
class NMFunction(pypes.component.Component):
"""
mandatory input packet attributes:
- data: f... | [
"logging.getLogger",
"itertools.zip_longest"
] | [((127, 154), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (144, 154), False, 'import logging\n'), ((2516, 2576), 'itertools.zip_longest', 'zip_longest', (['results', 'self._out_ports'], {'fillvalue': 'results[-1]'}), '(results, self._out_ports, fillvalue=results[-1])\n', (2527, 2576), ... |
import os
import math
import json
from bitarray import bitarray
from bitarray.util import ba2int, int2ba
class LECAlgorithm:
MAX_BITS = 14
def __init__(self):
self.table = ['00', '010', '011', '100', '101', '110', '1110', '11110', '111110', '1111110', '11111110', '111111110', '1111111110', '11111111110', '111... | [
"os.path.getsize",
"bitarray.util.ba2int",
"bitarray.bitarray"
] | [((415, 437), 'bitarray.bitarray', 'bitarray', ([], {'endian': '"""big"""'}), "(endian='big')\n", (423, 437), False, 'from bitarray import bitarray\n'), ((2224, 2246), 'bitarray.bitarray', 'bitarray', ([], {'endian': '"""big"""'}), "(endian='big')\n", (2232, 2246), False, 'from bitarray import bitarray\n'), ((1074, 110... |
# Copyright 2018 DataStax, 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 writin... | [
"src.utils.pick_value",
"src.utils.argus_debug",
"src.utils.get_input"
] | [((2892, 2943), 'src.utils.get_input', 'get_input', (['"""Remove [i]nclude, [e]xclude, or [q]uit"""'], {}), "('Remove [i]nclude, [e]xclude, or [q]uit')\n", (2901, 2943), False, 'from src.utils import argus_debug, get_input, pick_value\n'), ((2994, 3045), 'src.utils.pick_value', 'pick_value', (['"""Remove which include?... |
import numpy as np
from pymoo.model.survival import Survival
from pymoo.util.misc import calc_constraint_violation
class FitnessSurvival(Survival):
"""
This survival method is just for single-objective algorithm.
Simply sort by first constraint violation and then fitness value and truncate the worst ind... | [
"pymoo.util.misc.calc_constraint_violation",
"numpy.zeros"
] | [((565, 589), 'numpy.zeros', 'np.zeros', (['pop.F.shape[0]'], {}), '(pop.F.shape[0])\n', (573, 589), True, 'import numpy as np\n'), ((621, 653), 'pymoo.util.misc.calc_constraint_violation', 'calc_constraint_violation', (['pop.G'], {}), '(pop.G)\n', (646, 653), False, 'from pymoo.util.misc import calc_constraint_violati... |
#!/usr/bin/env python3
# Copyright 2018 Brocade Communications Systems LLC. 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 also obtain a copy of the License at
# http://www.apache.org/licenses/LICENS... | [
"pyfos.pyfos_auth.logout",
"pyfos.utils.brcd_util.getsession",
"pyfos.utils.brcd_util.parse",
"sys.exit",
"pyfos.pyfos_brocade_fibrechannel_configuration.fabric",
"pyfos.pyfos_util.response_print"
] | [((4657, 4675), 'pyfos.pyfos_brocade_fibrechannel_configuration.fabric', 'fabric', (['value_dict'], {}), '(value_dict)\n', (4663, 4675), False, 'from pyfos.pyfos_brocade_fibrechannel_configuration import fabric\n'), ((5131, 5201), 'pyfos.utils.brcd_util.parse', 'brcd_util.parse', (['argv', 'fabric', 'filters', '_valida... |
import turtle as t
t.goto(100,0)
for i in range(50):
t.left(80)
t.fd(100)
t.left(135)
t.fd(105) | [
"turtle.goto",
"turtle.left",
"turtle.fd"
] | [((19, 33), 'turtle.goto', 't.goto', (['(100)', '(0)'], {}), '(100, 0)\n', (25, 33), True, 'import turtle as t\n'), ((58, 68), 'turtle.left', 't.left', (['(80)'], {}), '(80)\n', (64, 68), True, 'import turtle as t\n'), ((73, 82), 'turtle.fd', 't.fd', (['(100)'], {}), '(100)\n', (77, 82), True, 'import turtle as t\n'), ... |
#!/usr/bin/env pytest
import pytest
import sys
sys.path.append("..")
from glm import vec3
from qork.util import *
from qork.node import Node
from qork.minimal import MinimalCore
from qork.util import walk
def test_node():
world = Node()
# move/position
assert fcmp(world.position, vec3(0))
world.mov... | [
"qork.node.Node",
"glm.vec3",
"sys.path.append"
] | [((48, 69), 'sys.path.append', 'sys.path.append', (['""".."""'], {}), "('..')\n", (63, 69), False, 'import sys\n'), ((238, 244), 'qork.node.Node', 'Node', ([], {}), '()\n', (242, 244), False, 'from qork.node import Node\n'), ((490, 497), 'glm.vec3', 'vec3', (['(0)'], {}), '(0)\n', (494, 497), False, 'from glm import ve... |
from textx.model import children_of_type, metamodel
# should probably go into handcoded 'FuncDef' class
def side_effects(funcdef):
if funcdef.is_procedure:
side_effs = [asgn.variable.name
for asgn in children_of_type('Assignment', funcdef)
if is_assignment(asgn)
... | [
"textx.model.children_of_type",
"textx.model.metamodel"
] | [((768, 802), 'textx.model.children_of_type', 'children_of_type', (['"""Negation"""', 'node'], {}), "('Negation', node)\n", (784, 802), False, 'from textx.model import children_of_type, metamodel\n'), ((851, 885), 'textx.model.children_of_type', 'children_of_type', (['"""FuncCall"""', 'node'], {}), "('FuncCall', node)\... |
from rest_framework.views import APIView, Response
from myapp.models import User, File, UserBrowseFile, UserKeptFile, Team, Comment
from myapp.serializers import CommentSer
from myapp.views import chk_token
from .userfile import chk_file_id
class CommentFile(APIView):
def post(self, request):
token = requ... | [
"myapp.serializers.CommentSer",
"myapp.models.User.objects.get",
"myapp.views.chk_token",
"myapp.models.Comment.objects.create"
] | [((501, 517), 'myapp.views.chk_token', 'chk_token', (['token'], {}), '(token)\n', (510, 517), False, 'from myapp.views import chk_token\n'), ((599, 627), 'myapp.models.User.objects.get', 'User.objects.get', ([], {'pk': 'user_id'}), '(pk=user_id)\n', (615, 627), False, 'from myapp.models import User, File, UserBrowseFil... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# wxgonk.py
# TODO:
# Eventually, index.html should be used
# to present the data (i.e. build the display table). For troubleshooting
# purposes, can also turn this into an AFI 11-202v3 tutorial.
# -Include an option for using USAF rules vice FAA rules. Under FAA rule... | [
"logging.basicConfig",
"random.choice",
"logging.debug",
"countries.make_country_dict",
"wxurlmaker.make_adds_url",
"datetime.datetime.strptime",
"wxurlmaker.make_metar_taf_url",
"re.match",
"logging.warning",
"requests.get",
"countries.is_valid_country",
"countries.country_name_from_code",
... | [((1107, 1288), 'logging.basicConfig', 'logging.basicConfig', ([], {'level': 'logging.DEBUG', 'filename': '""".logs/test.log"""', 'filemode': '"""w"""', 'format': '"""\n%(asctime)s - %(filename)s: line %(lineno)s, %(funcName)s: %(message)s"""'}), '(level=logging.DEBUG, filename=\'.logs/test.log\',\n filemode=\'w\', ... |
from django.db import models
from django.contrib.auth import get_user_model, authenticate, login, logout
User = get_user_model()
# Create your models here.
class Teacher(models.Model):
name = models.CharField(max_length=100)
email = models.EmailField(max_length=255, unique=True, verbose_name='email address')... | [
"django.contrib.auth.get_user_model",
"django.db.models.EmailField",
"django.db.models.ForeignKey",
"django.db.models.BooleanField",
"django.db.models.CharField"
] | [((113, 129), 'django.contrib.auth.get_user_model', 'get_user_model', ([], {}), '()\n', (127, 129), False, 'from django.contrib.auth import get_user_model, authenticate, login, logout\n'), ((199, 231), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(100)'}), '(max_length=100)\n', (215, 231), Fal... |
"""
Author: <NAME>
Last change: 7pm 8/12/2020
linkedin: https://www.linkedin.com/in/abraham-lemus-ruiz/
"""
import requests
import pandas as pd
import numpy as np
from sklearn.metrics import accuracy_score,mean_squared_error, r2_score
from sklearn.model_selection import train_test_split
from sklearn.linear_model imp... | [
"requests.post",
"sklearn.preprocessing.PolynomialFeatures",
"pandas.read_csv",
"sklearn.model_selection.train_test_split",
"sklearn.preprocessing.OneHotEncoder",
"sklearn.linear_model.Ridge",
"sklearn.impute.KNNImputer",
"sklearn.metrics.mean_squared_error",
"sklearn.preprocessing.StandardScaler",
... | [((1859, 1904), 'pandas.read_csv', 'pd.read_csv', (['"""train_dataset_digitalhouse.csv"""'], {}), "('train_dataset_digitalhouse.csv')\n", (1870, 1904), True, 'import pandas as pd\n'), ((2693, 2914), 'sklearn.compose.ColumnTransformer', 'ColumnTransformer', (["[('ed_exp', numeric_transformer1, numeric_for_knnimputer1), ... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Time : 2019-04-17 15:58
# @Author : erwin
import numpy as np
from common.util_function import *
np.set_printoptions(precision=3)
arr = np.linspace(0, 100, 10).reshape((2, 5))
print_line("原始数据")
print_br(arr)
print_line("单个array操作")
print_br(np.add(arr, 2))
print_b... | [
"numpy.abs",
"numpy.multiply",
"numpy.ceil",
"numpy.sqrt",
"numpy.add",
"numpy.power",
"numpy.round",
"numpy.floor",
"numpy.subtract",
"numpy.linspace",
"numpy.cos",
"numpy.sin",
"numpy.divide",
"numpy.set_printoptions"
] | [((150, 182), 'numpy.set_printoptions', 'np.set_printoptions', ([], {'precision': '(3)'}), '(precision=3)\n', (169, 182), True, 'import numpy as np\n'), ((297, 311), 'numpy.add', 'np.add', (['arr', '(2)'], {}), '(arr, 2)\n', (303, 311), True, 'import numpy as np\n'), ((322, 341), 'numpy.subtract', 'np.subtract', (['arr... |
from django.views.decorators.csrf import csrf_exempt
from django.shortcuts import render
from django.http import HttpResponse, HttpResponseBadRequest
from django.contrib.auth import authenticate
from django.db import connection
from datetime import datetime
from vehicle.models import Vehicle, Route, VehicleRoute, Vehic... | [
"logging.getLogger",
"django.contrib.auth.authenticate",
"json.loads",
"django.http.HttpResponseBadRequest",
"datetime.datetime.strptime",
"django.http.HttpResponse",
"json.dumps",
"vehicle.models.VehicleStatus.objects.filter",
"datetime.datetime.now",
"vehicle.models.Route.objects.values_list",
... | [((529, 556), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (546, 556), False, 'import logging\n'), ((616, 667), 'django.http.HttpResponse', 'HttpResponse', (['"""{}"""'], {'content_type': '"""application/json"""'}), "('{}', content_type='application/json')\n", (628, 667), False, 'from d... |
import discord
from discord.ext import commands
import random
import asyncio
PARTY_ROLE_ID = None # Give as a int
class Role(commands.Cog):
def __init__(self, bot):
self.bot = bot
@commands.command()
async def party(self, ctx):
role = ctx.guild.get_role(PARTY_ROLE_ID)
... | [
"random.randint",
"discord.ext.commands.command",
"asyncio.sleep"
] | [((211, 229), 'discord.ext.commands.command', 'commands.command', ([], {}), '()\n', (227, 229), False, 'from discord.ext import commands\n'), ((443, 461), 'asyncio.sleep', 'asyncio.sleep', (['(0.1)'], {}), '(0.1)\n', (456, 461), False, 'import asyncio\n'), ((394, 421), 'random.randint', 'random.randint', (['(0)', '(167... |
import networkx
import numpy
import chainer
from chainer_chemistry.dataset.graph_dataset.base_graph_dataset import PaddingGraphDataset, SparseGraphDataset # NOQA
from chainer_chemistry.dataset.graph_dataset.base_graph_data import PaddingGraphData, SparseGraphData # NOQA
from chainer_chemistry.dataset.graph_dataset.f... | [
"chainer_chemistry.dataset.graph_dataset.base_graph_dataset.SparseGraphDataset",
"numpy.ones",
"networkx.to_numpy_array",
"numpy.argsort",
"numpy.array",
"numpy.empty",
"chainer_chemistry.dataset.graph_dataset.base_graph_dataset.PaddingGraphDataset",
"numpy.all"
] | [((2023, 2060), 'numpy.empty', 'numpy.empty', (['n_edges'], {'dtype': 'numpy.int'}), '(n_edges, dtype=numpy.int)\n', (2034, 2060), False, 'import numpy\n'), ((2077, 2114), 'numpy.empty', 'numpy.empty', (['n_edges'], {'dtype': 'numpy.int'}), '(n_edges, dtype=numpy.int)\n', (2088, 2114), False, 'import numpy\n'), ((2132,... |
# Generated by Django 3.0.10 on 2021-01-20 00:32
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('main', '0010_auto_20210120_0029'),
]
operations = [
migrations.AddField(
model_name='auctionlot',
name='collected',... | [
"django.db.models.BooleanField"
] | [((339, 399), 'django.db.models.BooleanField', 'models.BooleanField', ([], {'default': '(False)', 'verbose_name': '"""Collected"""'}), "(default=False, verbose_name='Collected')\n", (358, 399), False, 'from django.db import migrations, models\n')] |
import tensorflow as tf
from datetime import datetime
from packaging import version
from tensorflow import keras
import numpy as np
def celsius_to_fahrenheit(c):
return (c * (9/5)) + 32
model = keras.models.Sequential([
keras.layers.Dense(16, input_dim=1, activation='relu'),
keras.layers.Dense(6, activat... | [
"numpy.random.normal",
"tensorflow.keras.layers.Dense",
"tensorflow.keras.callbacks.TensorBoard"
] | [((410, 453), 'tensorflow.keras.callbacks.TensorBoard', 'keras.callbacks.TensorBoard', ([], {'log_dir': 'logdir'}), '(log_dir=logdir)\n', (437, 453), False, 'from tensorflow import keras\n'), ((589, 630), 'numpy.random.normal', 'np.random.normal', ([], {'size': '(500, 224, 224, 3)'}), '(size=(500, 224, 224, 3))\n', (60... |
import datetime
import json
from source.util.util_base.db import (get_multi_data, get_single_value,
update_data)
from source.util.util_data.basic_info import BasicInfo
class NoteData:
def __init__(self, db_conn):
self.db_conn = db_conn
async def note_insert(self... | [
"source.util.util_base.db.update_data",
"json.loads",
"source.util.util_base.db.get_multi_data",
"datetime.datetime.now",
"source.util.util_base.db.get_single_value"
] | [((3399, 3417), 'json.loads', 'json.loads', (['result'], {}), '(result)\n', (3409, 3417), False, 'import json\n'), ((613, 636), 'datetime.datetime.now', 'datetime.datetime.now', ([], {}), '()\n', (634, 636), False, 'import datetime\n'), ((653, 689), 'source.util.util_base.db.update_data', 'update_data', (['self.db_conn... |
# Copyright (c) 2020, salesforce.com, inc.
# All rights reserved.
# SPDX-License-Identifier: BSD-3-Clause
# For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/BSD-3-Clause
import sys
import torch
import transformers
import numpy as np
from contexttimer import Timer
from typ... | [
"transformers.TrainingArguments",
"experiments.misc_utils.is_prediction_correct",
"experiments.misc_utils.create_datasets",
"experiments.remote_utils.save_and_mirror_scp_to_remote",
"numpy.argmax",
"numpy.squeeze",
"experiments.misc_utils.get_dataloader",
"experiments.misc_utils.create_tokenizer_and_m... | [((1520, 1610), 'experiments.misc_utils.get_dataloader', 'misc_utils.get_dataloader', ([], {'dataset': 'train_dataset', 'batch_size': 'batch_size', 'random': 'random'}), '(dataset=train_dataset, batch_size=batch_size,\n random=random)\n', (1545, 1610), False, 'from experiments import misc_utils\n'), ((1646, 1947), '... |
import json
import time
from typing import Optional
from json import JSONEncoder
class TimeKept():
start: float
stop: float
range: float
def __init__(self,start: float,stop: float,range: float):
self.start = start
self.stop = stop
self.range = range
def asdict(self):
return {'start': ... | [
"json.dumps",
"time.time"
] | [((1829, 1845), 'json.dumps', 'json.dumps', (['hout'], {}), '(hout)\n', (1839, 1845), False, 'import json\n'), ((724, 735), 'time.time', 'time.time', ([], {}), '()\n', (733, 735), False, 'import time\n')] |
import numpy as np
# PyTorch stuff
import torch
# ------ MINE-F LOSS FUNCTION ------ #
def minef_loss(x_sample, y_sample, model, device):
# Shuffle y-data for the second expectation
idxs = np.random.choice(
range(len(y_sample)), size=len(y_sample), replace=False)
# We need y_shuffle attached to ... | [
"torch.log",
"torch.mean",
"torch.exp",
"numpy.exp",
"torch.tensor"
] | [((1190, 1266), 'torch.tensor', 'torch.tensor', (['x_sample'], {'dtype': 'torch.float', 'device': 'device', 'requires_grad': '(True)'}), '(x_sample, dtype=torch.float, device=device, requires_grad=True)\n', (1202, 1266), False, 'import torch\n'), ((1291, 1367), 'torch.tensor', 'torch.tensor', (['y_sample'], {'dtype': '... |
# -*- coding: utf-8 -*-
# Copyright 2020 Green Valley Belgium NV
#
# 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 appl... | [
"os.path.dirname",
"solutions.common.models.vcard.VCardInfo.create_key"
] | [((877, 902), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (892, 902), False, 'import os\n'), ((1146, 1175), 'solutions.common.models.vcard.VCardInfo.create_key', 'VCardInfo.create_key', (['user_id'], {}), '(user_id)\n', (1166, 1175), False, 'from solutions.common.models.vcard import VCardI... |
import glob
import os.path as path
import pandas
from loader.Loader import Loader
class IMDbLoader(Loader):
def __init__(self, data_directory, pos_directory, neg_directory):
super().__init__(['negative', 'positive'])
self.data_directory = data_directory
self.pos_directory = pos_director... | [
"pandas.DataFrame",
"os.path.join",
"glob.glob"
] | [((539, 607), 'pandas.DataFrame', 'pandas.DataFrame', (['(neg_data + pos_data)'], {'columns': "['sentiment', 'text']"}), "(neg_data + pos_data, columns=['sentiment', 'text'])\n", (555, 607), False, 'import pandas\n'), ((749, 799), 'os.path.join', 'path.join', (['self.data_directory', 'directory', '"""*.txt"""'], {}), "... |
# -*- coding: utf-8 -*-
#
#
# Copyright © 2017 Easy
#
# LICENSE: MIT
"""
name:local_readinglists_screen
"""
from kivy.app import App
from kivy.clock import Clock
from kivy.core.window import Window
from kivy.metrics import dp
from kivy.properties import (
BooleanProperty,
DictProperty,
NumericProperty,... | [
"kivy.properties.NumericProperty",
"kivy.properties.DictProperty",
"os.path.join",
"libs.uix.baseclass.server_readinglists_screen.ReadingListComicImage",
"kivy.app.App.get_running_app",
"kivymd.toast.kivytoast.kivytoast.toast",
"kivy.metrics.dp",
"libs.utils.paginator.Paginator",
"libs.utils.comic_j... | [((865, 881), 'kivy.properties.StringProperty', 'StringProperty', ([], {}), '()\n', (879, 881), False, 'from kivy.properties import BooleanProperty, DictProperty, NumericProperty, ObjectProperty, StringProperty\n'), ((900, 917), 'kivy.properties.NumericProperty', 'NumericProperty', ([], {}), '()\n', (915, 917), False, ... |
#!/usr/bin/env python
# coding: utf-8 -*-
#
# GNU General Public License v3.0+
#
# Copyright 2022 Arista Networks AS-EMEA
#
# 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.ap... | [
"logging.getLogger",
"traceback.format_exc",
"concurrent.futures.ThreadPoolExecutor",
"re.match",
"os.cpu_count"
] | [((1780, 1807), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (1797, 1807), False, 'import logging\n'), ((1599, 1621), 'traceback.format_exc', 'traceback.format_exc', ([], {}), '()\n', (1619, 1621), False, 'import traceback\n'), ((15287, 15332), 're.match', 're.match', (['filter', 'devic... |
"""
This code defines a class which builds a suitable polygon problem.
"""
# Standard imports.
import random
# Local imports.
import config
from polygon import Polygon
from word_arbiter import WordArbiter
##############
# MAIN CLASS #
##############
class PuzzleMaker:
""" The class in question. """
def __in... | [
"word_arbiter.WordArbiter",
"polygon.Polygon",
"random.shuffle"
] | [((1554, 1576), 'random.shuffle', 'random.shuffle', (['result'], {}), '(result)\n', (1568, 1576), False, 'import random\n'), ((360, 373), 'word_arbiter.WordArbiter', 'WordArbiter', ([], {}), '()\n', (371, 373), False, 'from word_arbiter import WordArbiter\n'), ((640, 701), 'polygon.Polygon', 'Polygon', (['decomposition... |
from django.db import models
from django.core.validators import MinValueValidator, MaxValueValidator
# Create your models here.
class Template(models.Model):
template_type=models.CharField(max_length=200,db_index=True)
template_name=models.CharField(unique=True,max_length=200,db_index=True)
slug=models.Sl... | [
"django.core.validators.MaxValueValidator",
"django.db.models.TextField",
"django.db.models.BooleanField",
"django.db.models.SlugField",
"django.db.models.ImageField",
"django.core.validators.MinValueValidator",
"django.db.models.CharField"
] | [((178, 225), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(200)', 'db_index': '(True)'}), '(max_length=200, db_index=True)\n', (194, 225), False, 'from django.db import models\n'), ((243, 303), 'django.db.models.CharField', 'models.CharField', ([], {'unique': '(True)', 'max_length': '(200)', ... |
import os
from flask.app import Flask
from oidcmsg.configure import Configuration
from oidcmsg.configure import create_from_config_file
from fedservice.configure import FedRPConfiguration
from fedservice.rp import init_oidc_rp_handler
dir_path = os.path.dirname(os.path.realpath(__file__))
def oidc_provider_init_ap... | [
"os.path.realpath",
"fedservice.rp.init_oidc_rp_handler",
"oidcmsg.configure.create_from_config_file",
"flask.app.Flask"
] | [((265, 291), 'os.path.realpath', 'os.path.realpath', (['__file__'], {}), '(__file__)\n', (281, 291), False, 'import os\n'), ((395, 436), 'flask.app.Flask', 'Flask', (['name'], {'static_url_path': '""""""'}), "(name, static_url_path='', **kwargs)\n", (400, 436), False, 'from flask.app import Flask\n'), ((459, 607), 'oi... |
from flask import Blueprint, request, jsonify
from flask.ext.login import login_user, login_required
from flask.ext.login import logout_user
from extensions import login_manager, db
from app_exceptions import UserInputError
from .models import User
user_app = Blueprint('user_app', __name__)
@login_manager.user_loa... | [
"flask.ext.login.logout_user",
"flask.request.form.get",
"extensions.db.session.add",
"extensions.db.session.commit",
"flask.ext.login.login_user",
"app_exceptions.UserInputError",
"flask.Blueprint",
"flask.jsonify"
] | [((263, 294), 'flask.Blueprint', 'Blueprint', (['"""user_app"""', '__name__'], {}), "('user_app', __name__)\n", (272, 294), False, 'from flask import Blueprint, request, jsonify\n'), ((461, 474), 'flask.ext.login.logout_user', 'logout_user', ([], {}), '()\n', (472, 474), False, 'from flask.ext.login import logout_user\... |
import numpy as np
import matplotlib.pyplot as plot
import cPickle
import mscentipede
import argparse
import gzip
def plot_profile(footprint_model, background_model, mlen, protocol):
foreground = np.array([1])
for j in xrange(footprint_model.J):
foreground = np.array([p for val in foreground for p in ... | [
"argparse.ArgumentParser",
"gzip.open",
"numpy.array",
"matplotlib.pyplot.figure",
"cPickle.load",
"numpy.arange"
] | [((202, 215), 'numpy.array', 'np.array', (['[1]'], {}), '([1])\n', (210, 215), True, 'import numpy as np\n'), ((467, 480), 'numpy.array', 'np.array', (['[1]'], {}), '([1])\n', (475, 480), True, 'import numpy as np\n'), ((730, 743), 'matplotlib.pyplot.figure', 'plot.figure', ([], {}), '()\n', (741, 743), True, 'import m... |
"""
!git
clone
https: // bitbucket.org / jadslim / german - traffic - signs
!ls
german - traffic - sign
"""
import numpy as np
import matplotlib.pyplot as plt
import keras
from keras.models import Sequential
from keras.optimizers import Adam
from keras.layers import Dense
from keras.layers import Flatten, Dropout
from... | [
"pandas.read_csv",
"matplotlib.pyplot.ylabel",
"keras.preprocessing.image.ImageDataGenerator",
"keras.layers.Dense",
"matplotlib.pyplot.imshow",
"matplotlib.pyplot.xlabel",
"matplotlib.pyplot.plot",
"numpy.asarray",
"numpy.random.seed",
"matplotlib.pyplot.axis",
"keras.optimizers.Adam",
"keras... | [((574, 591), 'numpy.random.seed', 'np.random.seed', (['(0)'], {}), '(0)\n', (588, 591), True, 'import numpy as np\n'), ((1900, 1949), 'pandas.read_csv', 'pd.read_csv', (['"""german-traffic-signs/signnames.csv"""'], {}), "('german-traffic-signs/signnames.csv')\n", (1911, 1949), True, 'import pandas as pd\n'), ((2010, 2... |
# import standard packages
# import external packages
import numpy as np
from mendeleev import element
from math import pi, log
# import internal packages
import check_inputs
import config
import staticKS
import convergence
import writeoutput
import xc
class ISModel:
def __init__(
self,
atom,
... | [
"check_inputs.ISModel.check_unbound",
"math.log",
"staticKS.Potential.calc_v_en",
"staticKS.Density",
"writeoutput.write_ISModel_data",
"writeoutput.SCF",
"check_inputs.ISModel.calc_nele",
"check_inputs.ISModel.check_bc",
"check_inputs.ISModel.check_spinmag",
"staticKS.Energy",
"check_inputs.Ene... | [((2800, 2843), 'check_inputs.ISModel.check_spinpol', 'check_inputs.ISModel.check_spinpol', (['spinpol'], {}), '(spinpol)\n', (2834, 2843), False, 'import check_inputs\n'), ((3696, 3754), 'check_inputs.ISModel.check_spinmag', 'check_inputs.ISModel.check_spinmag', (['spinmag', 'self.nele_tot'], {}), '(spinmag, self.nele... |
import unittest
import numpy as np
from scipy.spatial.distance import cdist
from hmc import mmd
class TestMMD(unittest.TestCase):
def test_mmd(self):
n = int(1000*np.random.uniform())
m = int(1000*np.random.uniform())
k = int(10*np.random.uniform())
x = np.random.normal(size=(m, k... | [
"numpy.random.normal",
"numpy.allclose",
"numpy.triu_indices",
"scipy.spatial.distance.cdist",
"numpy.random.exponential",
"numpy.sum",
"numpy.random.uniform",
"hmc.mmd"
] | [((293, 322), 'numpy.random.normal', 'np.random.normal', ([], {'size': '(m, k)'}), '(size=(m, k))\n', (309, 322), True, 'import numpy as np\n'), ((335, 364), 'numpy.random.normal', 'np.random.normal', ([], {'size': '(n, k)'}), '(size=(n, k))\n', (351, 364), True, 'import numpy as np\n'), ((378, 401), 'numpy.random.expo... |
#!/usr/bin/env python3
import numpy as np
import os
import shutil
from PIL import Image
import cv2
from scipy.misc import imread
pascal_colormap = [
0, 0, 0,
0.5020, 0, 0,
0, 0.5020, 0,
0.5020, 0.5020, 0,
0, 0, 0.5020,
0.5020, 0, 0.5020,
0, 0.5020, 0.5020,
0.5020, 0.5020, 0.5020,
0... | [
"os.path.exists",
"numpy.repeat",
"os.makedirs",
"numpy.where",
"PIL.Image.new",
"numpy.array",
"scipy.misc.imread",
"numpy.zeros",
"cv2.cvtColor",
"shutil.rmtree",
"numpy.zeros_like"
] | [((9388, 9405), 'scipy.misc.imread', 'imread', (['image_dir'], {}), '(image_dir)\n', (9394, 9405), False, 'from scipy.misc import imread\n'), ((9769, 9793), 'PIL.Image.new', 'Image.new', (['"""P"""', '(16, 16)'], {}), "('P', (16, 16))\n", (9778, 9793), False, 'from PIL import Image\n'), ((10120, 10152), 'os.path.exists... |
import datetime
import operator
import time
from functools import reduce
from app.main.model.snapshot_model import Snapshot
from app.main.model.synonym_model import Synonym
_current_milli_time = lambda: int(round(time.time() * 1000))
def _format_chart_date(date):
return datetime.datetime.strftime(date, '%Y-%m-%... | [
"datetime.datetime.utcnow",
"functools.reduce",
"app.main.model.snapshot_model.Snapshot.query.select_from",
"app.main.model.synonym_model.Synonym.synonym.in_",
"operator.itemgetter",
"datetime.datetime.strftime",
"time.time"
] | [((279, 332), 'datetime.datetime.strftime', 'datetime.datetime.strftime', (['date', '"""%Y-%m-%d %H:%M:%S"""'], {}), "(date, '%Y-%m-%d %H:%M:%S')\n", (305, 332), False, 'import datetime\n'), ((2953, 2989), 'functools.reduce', 'reduce', (['(lambda x, y: x & y)', 'all_keys'], {}), '(lambda x, y: x & y, all_keys)\n', (295... |
#/********************************************************************************
#* AUDETEMI INC. ("COMPANY") CONFIDENTIAL
#*_______________________________________
#*
#* Unpublished Copyright (c) 2015-2017 [AUDETEMI INC].
#* http://www.audetemi.com.
#* All Rights Reserved.
#*
#* NOTICE: All information contained he... | [
"multimedia_chat.views.MessageList.as_view"
] | [((1953, 1980), 'multimedia_chat.views.MessageList.as_view', 'views.MessageList.as_view', ([], {}), '()\n', (1978, 1980), False, 'from multimedia_chat import views\n')] |
from model.contact import Contact
from generator.random import random_string
import getopt
import sys
import os
import jsonpickle
try:
opts, args = getopt.getopt(sys.argv[1:], "n:f:", ["number of groups", "file"])
except getopt.GetoptError as err:
getopt.usage()
sys.exit(2)
n = 5
f = 'data/contacts.json'
... | [
"jsonpickle.set_encoder_options",
"getopt.getopt",
"generator.random.random_string",
"getopt.usage",
"sys.exit",
"os.path.abspath",
"jsonpickle.encode",
"model.contact.Contact"
] | [((153, 218), 'getopt.getopt', 'getopt.getopt', (['sys.argv[1:]', '"""n:f:"""', "['number of groups', 'file']"], {}), "(sys.argv[1:], 'n:f:', ['number of groups', 'file'])\n", (166, 218), False, 'import getopt\n'), ((735, 783), 'jsonpickle.set_encoder_options', 'jsonpickle.set_encoder_options', (['"""json"""'], {'inden... |
"""rollback module for the cli."""
import logging
from subprocess import CalledProcessError, PIPE, Popen, check_call
import click
from iocage.lib.ioc_common import checkoutput
from iocage.lib.ioc_json import IOCJson
from iocage.lib.ioc_list import IOCList
__cmdname__ = "rollback_cmd"
__rootcmd__ = True
@click.comm... | [
"logging.getLogger",
"click.argument",
"click.confirm",
"iocage.lib.ioc_common.checkoutput",
"iocage.lib.ioc_json.IOCJson",
"click.option",
"iocage.lib.ioc_list.IOCList",
"click.command"
] | [((310, 378), 'click.command', 'click.command', ([], {'name': '"""rollback"""', 'help': '"""Rollbacks the specified jail."""'}), "(name='rollback', help='Rollbacks the specified jail.')\n", (323, 378), False, 'import click\n'), ((380, 402), 'click.argument', 'click.argument', (['"""jail"""'], {}), "('jail')\n", (394, 4... |
# Import Param
import Param
xmlpath = 'H:/cloud/cloud_data/Projects/MDDoc/init/init.xml'
Param.param.init(xmlpath)
Param.param.create()
Param.param.write()
Param.param.printParams()
| [
"Param.param.printParams",
"Param.param.write",
"Param.param.create",
"Param.param.init"
] | [((90, 115), 'Param.param.init', 'Param.param.init', (['xmlpath'], {}), '(xmlpath)\n', (106, 115), False, 'import Param\n'), ((116, 136), 'Param.param.create', 'Param.param.create', ([], {}), '()\n', (134, 136), False, 'import Param\n'), ((137, 156), 'Param.param.write', 'Param.param.write', ([], {}), '()\n', (154, 156... |
# Generated by Django 2.2 on 2021-01-08 20:08
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
('recipes', '0001_initial'),
migrations.swappable_dependency(settin... | [
"django.db.models.AutoField",
"django.db.migrations.swappable_dependency",
"django.db.models.UniqueConstraint",
"django.db.models.ForeignKey"
] | [((282, 339), 'django.db.migrations.swappable_dependency', 'migrations.swappable_dependency', (['settings.AUTH_USER_MODEL'], {}), '(settings.AUTH_USER_MODEL)\n', (313, 339), False, 'from django.db import migrations, models\n'), ((1813, 1892), 'django.db.models.UniqueConstraint', 'models.UniqueConstraint', ([], {'fields... |
#!/usr/bin/env ipython
"""
Producer script for BOT PTC analysis.
"""
import os
from ptc_jh_task import ptc_jh_task
from bot_eo_analyses import get_analysis_types, run_python_task_or_cl_script
if 'ptc' in get_analysis_types():
ptc_task_script \
= os.path.join(os.environ['EOANALYSISJOBSDIR'], 'harnessed_jobs... | [
"bot_eo_analyses.run_python_task_or_cl_script",
"os.path.join",
"bot_eo_analyses.get_analysis_types"
] | [((205, 225), 'bot_eo_analyses.get_analysis_types', 'get_analysis_types', ([], {}), '()\n', (223, 225), False, 'from bot_eo_analyses import get_analysis_types, run_python_task_or_cl_script\n'), ((259, 361), 'os.path.join', 'os.path.join', (["os.environ['EOANALYSISJOBSDIR']", '"""harnessed_jobs"""', '"""ptc_BOT"""', '""... |
import copy
from typing import List
from ._QueryParameters.ActualQueryParameters import ActualQueryParameters
from ._QueryParameters.VersionedQueryParameters import VersionedQueryParameters
from ._QueryParameters.AuctionQueryParameters import AuctionQueryParameters
from ._QueryParameters.VersionedQueryParameters import... | [
"copy.deepcopy"
] | [((3630, 3650), 'copy.deepcopy', 'copy.deepcopy', (['param'], {}), '(param)\n', (3643, 3650), False, 'import copy\n')] |
''' Fill in the code to check if the text passed looks like a standard sentence,
meaning that it starts with an uppercase letter, followed by at least some
lowercase letters or a space, and ends with a period, question mark, or
exclamation point. '''
import re
def check_sentence(text):
result = re.search... | [
"re.search"
] | [((311, 357), 're.search', 're.search', (['"""^[A-Z][a-z\\\\s]*[\\\\.\\\\?\\\\!]$"""', 'text'], {}), "('^[A-Z][a-z\\\\s]*[\\\\.\\\\?\\\\!]$', text)\n", (320, 357), False, 'import re\n')] |
import numpy as np
import torch.nn as nn
import torch
import torch.nn.functional as F
from torch.utils.data import Dataset
import math
def conv3x3(in_planes, out_planes, stride=1):
"""3x3 convolution with padding"""
return nn.Conv2d(in_planes, out_planes, kernel_size=3, stride=stride, padding=1, bias=True)
... | [
"torch.nn.BatchNorm2d",
"torch.nn.Sigmoid",
"torch.nn.LeakyReLU",
"torch.nn.ModuleList",
"torch.nn.Conv2d",
"torch.randn"
] | [((232, 320), 'torch.nn.Conv2d', 'nn.Conv2d', (['in_planes', 'out_planes'], {'kernel_size': '(3)', 'stride': 'stride', 'padding': '(1)', 'bias': '(True)'}), '(in_planes, out_planes, kernel_size=3, stride=stride, padding=1,\n bias=True)\n', (241, 320), True, 'import torch.nn as nn\n'), ((3971, 3997), 'torch.randn', '... |
# -*- coding: utf-8 -*-
"""
feedjack
<NAME>
fjcloud.py
"""
import math
from feedjack import fjlib
from feedjack import fjcache
def getsteps(levels, tagmax):
""" Returns a list with the max number of posts per "tagcloud level"
"""
ntw = levels
if ntw < 2:
ntw = 2
steps = [(stp, 1 + (stp ... | [
"math.ceil",
"feedjack.fjcache.cache_set",
"feedjack.fjlib.getquery",
"feedjack.fjcache.cache_get"
] | [((1186, 1735), 'feedjack.fjlib.getquery', 'fjlib.getquery', (['("""\n SELECT feedjack_post.feed_id, feedjack_tag.name, COUNT(*)\n FROM feedjack_post, feedjack_subscriber, feedjack_tag,\n feedjack_post_tags\n WHERE feedjack_post.feed_id=feedjack_subscriber.feed_id AND\n feed... |
import discord
from discord.ext import commands, tasks
from discord.ext.commands import BucketType
from copy import deepcopy
from dateutil.relativedelta import relativedelta
import random
import asyncio
import datetime
from utility import words
from utility import working
from utility import Pag
shop = [
{
... | [
"dateutil.relativedelta.relativedelta",
"discord.ext.commands.CooldownMapping.from_cooldown",
"discord.ui.button",
"discord.ext.commands.group",
"copy.deepcopy",
"discord.ext.commands.command",
"asyncio.sleep",
"discord.ext.commands.CommandOnCooldown",
"discord.Embed",
"random.randint",
"discord... | [((8785, 8848), 'discord.ui.button', 'discord.ui.button', ([], {'label': '"""Hit"""', 'style': 'discord.ButtonStyle.green'}), "(label='Hit', style=discord.ButtonStyle.green)\n", (8802, 8848), False, 'import discord\n'), ((11606, 11671), 'discord.ui.button', 'discord.ui.button', ([], {'label': '"""Stand"""', 'style': 'd... |
#!/usr/bin/env python3
import jinja2
def setup_jinja():
# register templates
multi_loader = jinja2.ChoiceLoader([
jinja2.FileSystemLoader(searchpath=["./templates"]),
jinja2.PrefixLoader({
'govuk-jinja-components': jinja2.PackageLoader('govuk_jinja_components'),
'digita... | [
"jinja2.FileSystemLoader",
"jinja2.Environment",
"jinja2.PackageLoader"
] | [((412, 451), 'jinja2.Environment', 'jinja2.Environment', ([], {'loader': 'multi_loader'}), '(loader=multi_loader)\n', (430, 451), False, 'import jinja2\n'), ((132, 183), 'jinja2.FileSystemLoader', 'jinja2.FileSystemLoader', ([], {'searchpath': "['./templates']"}), "(searchpath=['./templates'])\n", (155, 183), False, '... |
import unittest
import json
from flask import Flask
from flask_proxy import Proxy, Upstream
class TestProxy(unittest.TestCase):
def setUp(self):
class HttpbinBase(Upstream):
prefix = '/httpbin'
host = 'httpbin.org'
self.HttpbinBase = HttpbinBase
class HttpbinGet(... | [
"flask_proxy.Proxy",
"json.loads",
"flask.Flask"
] | [((1116, 1131), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (1121, 1131), False, 'from flask import Flask\n'), ((1148, 1158), 'flask_proxy.Proxy', 'Proxy', (['app'], {}), '(app)\n', (1153, 1158), False, 'from flask_proxy import Proxy, Upstream\n'), ((1786, 1801), 'flask.Flask', 'Flask', (['__name__'], {... |
# Copyright (c) 2019 PaddlePaddle Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applic... | [
"os.path.exists",
"argparse.ArgumentParser",
"types.SimpleNamespace",
"os.path.join",
"yaml.load",
"requests.get",
"functools.partial"
] | [((1377, 1421), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '__doc__'}), '(description=__doc__)\n', (1400, 1421), False, 'import argparse\n'), ((1436, 1486), 'functools.partial', 'functools.partial', (['add_arguments'], {'argparser': 'parser'}), '(add_arguments, argparser=parser)\n', (145... |
import socket
import time
import argparse
parser = argparse.ArgumentParser()
parser.add_argument('--port-number', type=int, action='store', default=3000, help='Specify which server port you want to connect to')
args = parser.parse_args()
clientsocket= socket.socket(socket.AF_INET, socket.SOCK_STREAM)
clientsocket.conne... | [
"socket.socket",
"time.sleep",
"argparse.ArgumentParser"
] | [((51, 76), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (74, 76), False, 'import argparse\n'), ((252, 301), 'socket.socket', 'socket.socket', (['socket.AF_INET', 'socket.SOCK_STREAM'], {}), '(socket.AF_INET, socket.SOCK_STREAM)\n', (265, 301), False, 'import socket\n'), ((389, 403), 'time.sl... |
# pylint: disable=missing-module-docstring, redefined-outer-name, unused-argument, wrong-import-order, unused-import
import poetry.factory
import poetry.utils.env
import pytest
from poetry.puzzle.provider import Provider
from .fixtures import mock_poetry_factory
from .fixtures import mock_venv
from tox_poetry_installe... | [
"tox_poetry_installer.utilities.identify_transients",
"pytest.raises"
] | [((2430, 2487), 'tox_poetry_installer.utilities.identify_transients', 'utilities.identify_transients', (['"""requests"""', 'packages', 'venv'], {}), "('requests', packages, venv)\n", (2459, 2487), False, 'from tox_poetry_installer import utilities\n'), ((924, 972), 'pytest.raises', 'pytest.raises', (['exceptions.Locked... |
import logging
import os
from datetime import datetime
import random
from threading import Thread, Event
from pycocotools.coco import COCO
from ..db import Database
logger = logging.getLogger('load_coco')
def load_coco(db: Database, *,
coco_dir: str,
data_type: str = 'train2017',
... | [
"logging.getLogger",
"argparse.ArgumentParser",
"pycocotools.coco.COCO",
"threading.Event",
"datetime.datetime.now",
"threading.Thread"
] | [((177, 207), 'logging.getLogger', 'logging.getLogger', (['"""load_coco"""'], {}), "('load_coco')\n", (194, 207), False, 'import logging\n'), ((1050, 1057), 'threading.Event', 'Event', ([], {}), '()\n', (1055, 1057), False, 'from threading import Thread, Event\n'), ((2959, 3034), 'argparse.ArgumentParser', 'argparse.Ar... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
test_reheader
----------------------------------
Tests for `reheader` module.
"""
import csv
import re
from io import StringIO
import pytest
from reheader import reheadered
_raw_txt_1 = u"""name,email,zip,
<NAME>,<EMAIL>,45309,
<NAME>,<EMAIL>,12345-1234,
<NAME>,<EMA... | [
"re.compile",
"reheader.reheadered",
"pytest.raises",
"io.StringIO",
"csv.reader",
"re.search"
] | [((1028, 1048), 'reheader.reheadered', 'reheadered', (['[{}]', '[]'], {}), '([{}], [])\n', (1038, 1048), False, 'from reheader import reheadered\n'), ((1503, 1545), 'reheader.reheadered', 'reheadered', (['data', "['name', 'email', 'zip']"], {}), "(data, ['name', 'email', 'zip'])\n", (1513, 1545), False, 'from reheader ... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
from sqlalchemy import Column, String, Integer, ForeignKey, TIMESTAMP, func, and_, or_
from sqlalchemy.sql import text
from sqlalchemy.orm import sessionmaker, relationship, query, backref
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy import creat... | [
"sqlalchemy.orm.relationship",
"sqlalchemy.orm.sessionmaker",
"sqlalchemy.func.count",
"sqlalchemy.func.sum",
"tetueSrc.get_configuration",
"sqlalchemy.sql.text",
"sqlalchemy.create_engine",
"sqlalchemy.ForeignKey",
"sqlalchemy.TIMESTAMP",
"sqlalchemy.String",
"tetueSrc.get_int_element",
"sqla... | [((369, 407), 'tetueSrc.get_configuration', 'tetueSrc.get_configuration', (['"""database"""'], {}), "('database')\n", (395, 407), False, 'import tetueSrc\n'), ((415, 433), 'sqlalchemy.ext.declarative.declarative_base', 'declarative_base', ([], {}), '()\n', (431, 433), False, 'from sqlalchemy.ext.declarative import decl... |
'''
loadFromExcel.py is an example of a plug-in that will load an extension taxonomy from Excel
input and optionally save an (extension) DTS.
(c) Copyright 2016 Mark V Systems Limited, All rights reserved.
Example to run from web server:
1) POSTing excel in a zip, getting instance and log back in zip:
curl -k -v... | [
"zipfile.ZipFile",
"re.compile",
"io.open",
"sys.exc_info",
"arelle.ModelValue.qname",
"arelle.XmlUtil.addChild",
"arelle.ValidateXbrlDimensions.loadDimensionDefaults",
"arelle.PrototypeInstanceObject.DimValuePrototype",
"arelle.XmlValidate.validate",
"csv.reader",
"arelle.XbrlConst.isStandardAr... | [((3312, 3332), 'arelle.ModelValue.qname', 'qname', (['nsOim', '"""note"""'], {}), "(nsOim, 'note')\n", (3317, 3332), False, 'from arelle.ModelValue import qname\n'), ((3441, 3820), 're.compile', 're.compile', (['"""[_A-Za-zÀ-ÖØ-öø-ÿĀ-˿Ͱ-ͽͿ-\u1fff\u200c-\u200d⁰-\u218fⰀ-\u2fef、-\ud7ff豈-\ufdcfﷰ-�][_\\\\-\\\\.·A-Za-z0-9À-... |
#!/usr/bin/env python
"""
Python source code - replace this with a description of the code and write the code below this text.
"""
from string import Template
def main():
import sys
import os.path as osp
data_dir = sys.argv[1]
batch_size = sys.argv[2]
with open('./deploy.prototxt.in') as reader,... | [
"os.path.join"
] | [((326, 363), 'os.path.join', 'osp.join', (['data_dir', '"""deploy.prototxt"""'], {}), "(data_dir, 'deploy.prototxt')\n", (334, 363), True, 'import os.path as osp\n'), ((464, 495), 'os.path.join', 'osp.join', (['data_dir', '"""input.txt"""'], {}), "(data_dir, 'input.txt')\n", (472, 495), True, 'import os.path as osp\n'... |
#! /usr/bin/env python
# -*- coding: utf-8 -*-
"""
Module that contains DCC functionality for 3ds Max
"""
from __future__ import print_function, division, absolute_import
from collections import OrderedDict
from Qt.QtWidgets import QApplication, QMainWindow
import numpy as np
from pymxs import runtime as rt
from... | [
"pymxs.runtime.isValidNode",
"pymxs.runtime.actionMan.executeAction",
"pymxs.runtime.select",
"tpDcc.dccs.max.core.scene.get_selected_nodes",
"pymxs.runtime.getCurrentSelection",
"tpDcc.dccs.max.core.scene.new_scene",
"pymxs.runtime.getTransformLockFlags",
"tpDcc.dccs.max.core.helpers.get_max_version"... | [((1682, 1735), 'pymxs.runtime.pathConfig.setCurrentProjectFolder', 'rt.pathConfig.setCurrentProjectFolder', (['workspace_path'], {}), '(workspace_path)\n', (1719, 1735), True, 'from pymxs import runtime as rt\n'), ((1925, 1961), 'pymxs.runtime.actionMan.executeAction', 'rt.actionMan.executeAction', (['(0)', '"""310"""... |
# use nosetest to run these tests
from nose.tools import eq_
import inflect
FNAME = 'tests/words.txt'
# FNAME = 'tests/list-of-nouns.txt'
# FNAME = '/usr/share/dict/british-english'
# FNAME = 'tricky.txt'
def getwords():
words = open(FNAME).readlines()
words = [w.strip() for w in words]
return words
... | [
"inflect.engine"
] | [((347, 363), 'inflect.engine', 'inflect.engine', ([], {}), '()\n', (361, 363), False, 'import inflect\n')] |
# Generated by Django 2.1.7 on 2019-05-20 12:58
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('nodeodm', '0006_auto_20190220_1842'),
]
operations = [
migrations.RemoveField(
model_name='processingnode',
name='od... | [
"django.db.migrations.RemoveField",
"django.db.models.CharField"
] | [((235, 306), 'django.db.migrations.RemoveField', 'migrations.RemoveField', ([], {'model_name': '"""processingnode"""', 'name': '"""odm_version"""'}), "(model_name='processingnode', name='odm_version')\n", (257, 306), False, 'from django.db import migrations, models\n'), ((458, 544), 'django.db.models.CharField', 'mode... |
"""
Филды для сериалайзеров.
"""
import re
from rest_framework import serializers
class GraphListMultipleChoiceField(serializers.Field):
"""
Филд, для использования перечисления в текстовом поле. Взято из GraphQL.
>>> from rest_framework import serializers
>>>
>>>
>>> class ExampleSerialize... | [
"re.search",
"re.compile"
] | [((936, 953), 're.compile', 're.compile', (['"""\\\\s"""'], {}), "('\\\\s')\n", (946, 953), False, 'import re\n'), ((3910, 3927), 're.compile', 're.compile', (['"""\\\\s"""'], {}), "('\\\\s')\n", (3920, 3927), False, 'import re\n'), ((2961, 2990), 're.search', 're.search', (['self.re_space', 'itm'], {}), '(self.re_spac... |
from todocli.todo.config import lang_list, Lang
import re
class TestConfig(object):
def test_Lang(self):
lang = Lang('.py', [r"#\s*(TODO.*)"])
compiled_regex = lang.get_compiled_regexes()
assert isinstance(lang, Lang)
assert isinstance(compiled_regex, list)
assert compil... | [
"todocli.todo.config.Lang",
"re.compile"
] | [((126, 156), 'todocli.todo.config.Lang', 'Lang', (['""".py"""', "['#\\\\s*(TODO.*)']"], {}), "('.py', ['#\\\\s*(TODO.*)'])\n", (130, 156), False, 'from todocli.todo.config import lang_list, Lang\n'), ((335, 362), 're.compile', 're.compile', (['"""#\\\\s*(TODO.*)"""'], {}), "('#\\\\s*(TODO.*)')\n", (345, 362), False, '... |
import json
from django.http import JsonResponse
from django.shortcuts import render
# Create your views here.
from django.views import View
from django_redis import get_redis_connection
from apps.goods.models import SKU
from utils.response_code import RETCODE
"""
1. 如果用户未登录,可以实现添加购物车的功能.
如果用户登录,也可以实现添加购物车的功能.
... | [
"django.shortcuts.render",
"django_redis.get_redis_connection",
"django.http.JsonResponse",
"pickle.dumps",
"base64.b64encode",
"base64.b64decode",
"pickle.loads",
"apps.goods.models.SKU.objects.get"
] | [((15949, 15968), 'pickle.dumps', 'pickle.dumps', (['carts'], {}), '(carts)\n', (15961, 15968), False, 'import pickle\n'), ((16000, 16028), 'base64.b64encode', 'base64.b64encode', (['bytes_data'], {}), '(bytes_data)\n', (16016, 16028), False, 'import base64\n'), ((16137, 16166), 'base64.b64decode', 'base64.b64decode', ... |
#
# 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 not... | [
"liminal.core.config.config.ConfigUtil",
"logging.warning",
"liminal.core.util.files_util.resolve_pipeline_source_file",
"liminal.core.util.class_util.find_subclasses_in_packages",
"logging.info"
] | [((2294, 2350), 'logging.info', 'logging.info', (['f"""Loading image builder implementations.."""'], {}), "(f'Loading image builder implementations..')\n", (2306, 2350), False, 'import logging\n'), ((2548, 2626), 'liminal.core.util.class_util.find_subclasses_in_packages', 'class_util.find_subclasses_in_packages', (['[i... |
# -*- coding: utf-8 -*-
import tensorflow as tf
from tensorflow.core.protobuf import saver_pb2
import numpy as np
import cv2
import matplotlib.pyplot as plt
import os
from os.path import join as pjoin
import sys
import copy
import detect_face
import nn4 as network
import random
import sklearn
from sklearn.externals... | [
"cv2.rectangle",
"tensorflow.Graph",
"detect_face.create_mtcnn",
"tensorflow.ConfigProto",
"cv2.imshow",
"detect_face.detect_face",
"cv2.waitKey",
"numpy.empty",
"cv2.circle",
"cv2.cvtColor",
"tensorflow.GPUOptions",
"cv2.resize",
"cv2.imread"
] | [((1019, 1054), 'numpy.empty', 'np.empty', (['(w, h, 3)'], {'dtype': 'np.uint8'}), '((w, h, 3), dtype=np.uint8)\n', (1027, 1054), True, 'import numpy as np\n'), ((1613, 1636), 'cv2.imread', 'cv2.imread', (['sys.argv[1]'], {}), '(sys.argv[1])\n', (1623, 1636), False, 'import cv2\n'), ((1669, 1708), 'cv2.cvtColor', 'cv2.... |
import pytest
_endpoint: str = "http://localhost:5000"
@pytest.fixture(scope="module")
def url_endpoint() -> str:
"""Represent default url endpoint."""
return _endpoint
| [
"pytest.fixture"
] | [((59, 89), 'pytest.fixture', 'pytest.fixture', ([], {'scope': '"""module"""'}), "(scope='module')\n", (73, 89), False, 'import pytest\n')] |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.5 on 2017-10-22 10:28
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('parsed_data', '0005_auto_20171019_2318'),
]
operations = [
migrations.AddFi... | [
"django.db.models.CharField"
] | [((409, 450), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(5)', 'null': '(True)'}), '(max_length=5, null=True)\n', (425, 450), False, 'from django.db import migrations, models\n'), ((577, 618), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(5)', 'null': '(True)'}), '(... |
# -*- coding: utf-8 -*-
name = "twaddress"
from twaddress import algo
from slugify import slugify
import re
def _to_eng(cut_result, for_post=False):
code, city, road, village, address = cut_result
if for_post:
result = [road, village, '\n%s %s' % (city, code), '\nTaiwan (R.O.C.)']
else:
... | [
"twaddress.algo.mms_cut",
"re.findall",
"slugify.slugify"
] | [((857, 888), 're.findall', 're.findall', (['pattern', 'result_str'], {}), '(pattern, result_str)\n', (867, 888), False, 'import re\n'), ((1147, 1168), 'twaddress.algo.mms_cut', 'algo.mms_cut', (['address'], {}), '(address)\n', (1159, 1168), False, 'from twaddress import algo\n'), ((952, 994), 'slugify.slugify', 'slugi... |