code stringlengths 22 1.05M | apis listlengths 1 3.31k | extract_api stringlengths 75 3.25M |
|---|---|---|
async def notify_about_cancel_request(request, username, user_id):
from emoji import emojize
from loader import bot, db
from data.config import super_admins
emo_issuing_office = emojize(':office:', use_aliases=True)
emo_cash_recive = emojize(':chart_with_upwards_trend:', use_aliases=True)... | [
"emoji.emojize",
"loader.bot.send_message",
"loader.db.select_id_users"
] | [((201, 238), 'emoji.emojize', 'emojize', (['""":office:"""'], {'use_aliases': '(True)'}), "(':office:', use_aliases=True)\n", (208, 238), False, 'from emoji import emojize\n'), ((265, 320), 'emoji.emojize', 'emojize', (['""":chart_with_upwards_trend:"""'], {'use_aliases': '(True)'}), "(':chart_with_upwards_trend:', us... |
import os, shutil
import settings
class BaseVCS(object):
def __init__(self, name, anonymous_access, template=None):
"""
A base class to handle Version Control System functions
name = name of the repository
anonymous_access = Is it public?
template = The name of the ... | [
"os.path.exists",
"shutil.move",
"settings.VCS_CONFIG.values",
"shutil.rmtree",
"os.path.join"
] | [((1275, 1303), 'settings.VCS_CONFIG.values', 'settings.VCS_CONFIG.values', ([], {}), '()\n', (1301, 1303), False, 'import settings\n'), ((1563, 1588), 'os.path.exists', 'os.path.exists', (['self.path'], {}), '(self.path)\n', (1577, 1588), False, 'import os, shutil\n'), ((1924, 1949), 'shutil.move', 'shutil.move', (['s... |
import random
health = 50
difficulty = 3
potion_health = int(random.randint(25,50)/ difficulty)
health = health + potion_health
print (health)
import math
| [
"random.randint"
] | [((64, 86), 'random.randint', 'random.randint', (['(25)', '(50)'], {}), '(25, 50)\n', (78, 86), False, 'import random\n')] |
#-------------------------------------------------------------------------------
#
# FBI (Frame Based Inspector) Plugin.
#
# Written by: <NAME>
#
# Date: 1/4/2006
#
# (c) Copyright 2006 by Enthought, Inc.
#
#-------------------------------------------------------------------------------
#--------------------------... | [
"envisage.core.core_plugin_definition.PluginDefinition"
] | [((729, 1014), 'envisage.core.core_plugin_definition.PluginDefinition', 'PluginDefinition', ([], {'id': '"""envisage.plugins.debug.fbi"""', 'class_name': '"""envisage.plugins.debug.fbi_plugin.FBIPlugin"""', 'name': '"""FBI Plugin"""', 'version': '"""1.0.0"""', 'provider_name': '"""Enthought Inc"""', 'provider_url': '""... |
# -*- coding: utf-8 -*-
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: delete.proto
import sys
_b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1'))
from google.protobuf import descriptor as _descriptor
from google.protobuf import message as _message
from google.protobuf impo... | [
"google.protobuf.symbol_database.Default",
"google.protobuf.descriptor.FieldDescriptor",
"google.protobuf.reflection.GeneratedProtocolMessageType"
] | [((460, 486), 'google.protobuf.symbol_database.Default', '_symbol_database.Default', ([], {}), '()\n', (484, 486), True, 'from google.protobuf import symbol_database as _symbol_database\n'), ((4783, 4946), 'google.protobuf.reflection.GeneratedProtocolMessageType', '_reflection.GeneratedProtocolMessageType', (['"""Delet... |
#****************************************************#
# This file is part of OPTALG. #
# #
# Copyright (c) 2019, <NAME>. #
# #
# OPTALG is released under the BSD 2-clause license. #
#*****... | [
"xml.etree.ElementTree.parse",
"tempfile._get_candidate_names",
"os.remove",
"numpy.zeros",
"os.path.isfile",
"subprocess.call",
"multiprocessing.cpu_count"
] | [((1648, 1672), 'numpy.zeros', 'np.zeros', (['problem.c.size'], {}), '(problem.c.size)\n', (1656, 1672), True, 'import numpy as np\n'), ((1687, 1715), 'numpy.zeros', 'np.zeros', (['problem.A.shape[0]'], {}), '(problem.A.shape[0])\n', (1695, 1715), True, 'import numpy as np\n'), ((1729, 1740), 'numpy.zeros', 'np.zeros',... |
# encoding: utf-8
import os
import unittest
from configurationutil.cfg_providers import base_provider
from fdutil.path_tools import pop_path
class TestConfigurationObject(unittest.TestCase):
def setUp(self):
self.cfg_file = os.path.join(pop_path(__file__), u'test_config_object.json')
self.templa... | [
"unittest.main",
"configurationutil.cfg_providers.base_provider.ConfigObject",
"fdutil.path_tools.pop_path"
] | [((1559, 1574), 'unittest.main', 'unittest.main', ([], {}), '()\n', (1572, 1574), False, 'import unittest\n'), ((253, 271), 'fdutil.path_tools.pop_path', 'pop_path', (['__file__'], {}), '(__file__)\n', (261, 271), False, 'from fdutil.path_tools import pop_path\n'), ((338, 356), 'fdutil.path_tools.pop_path', 'pop_path',... |
"""
some class that used for monitor the stats information of
negmas during the time of simulation
monitor methode:
1. detect the information of changing file
2. detect the information of shared memory
"""
from abc import ABCMeta, abstractmethod
import os, time
from typing import Optional... | [
"asyncio.get_event_loop",
"os.getpid",
"asyncio.sleep",
"os.walk",
"time.time",
"asyncio.wait",
"threading.current_thread",
"os.listdir"
] | [((4833, 4844), 'time.time', 'time.time', ([], {}), '()\n', (4842, 4844), False, 'import os, time\n'), ((4932, 4956), 'asyncio.get_event_loop', 'asyncio.get_event_loop', ([], {}), '()\n', (4954, 4956), False, 'import asyncio\n'), ((4543, 4569), 'threading.current_thread', 'threading.current_thread', ([], {}), '()\n', (... |
import json
def save_json(data, fpath):
"Stores data as a JSON in the provided filepath."
with open(fpath, 'w') as f:
json.dump(data, f) | [
"json.dump"
] | [((135, 153), 'json.dump', 'json.dump', (['data', 'f'], {}), '(data, f)\n', (144, 153), False, 'import json\n')] |
import os
import mcvine, mcvine.components
instrument = mcvine.instrument()
# add source
source = mcvine.components.sources.Source_simple('source')
instrument.append(source, position=(0,0,0))
# add sample
sample = mcvine.components.samples.V_sample('sample')
instrument.append(sample, position=(0,0,1))
# add detector sy... | [
"mcvine.components.detectors.DetectorSystemFromXml",
"mcvine.components.samples.V_sample",
"mcvine.resources.instrument",
"mcvine.components.sources.Source_simple",
"mcvine.instrument"
] | [((56, 75), 'mcvine.instrument', 'mcvine.instrument', ([], {}), '()\n', (73, 75), False, 'import mcvine, mcvine.components\n'), ((98, 147), 'mcvine.components.sources.Source_simple', 'mcvine.components.sources.Source_simple', (['"""source"""'], {}), "('source')\n", (137, 147), False, 'import mcvine, mcvine.components\n... |
"""Test bench for the Verilog module 'nt_recv_capture_top'."""
# The MIT License
#
# Copyright (c) 2017-2019 by the author(s)
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restric... | [
"lib.axilite.AXI_Lite_Writer",
"lib.net.packet_to_axis_data",
"cocotb.result.TestFailure",
"random.randint",
"lib.axis.AXIS_Writer",
"lib.axilite.AXI_Lite_Reader",
"lib.mem.Mem",
"lib.tb.clk_gen",
"lib.net.gen_packet",
"cocotb.test",
"lib.tb.swp_byte_order",
"lib.tb.wait_n_cycles",
"lib.tb.r... | [((11054, 11067), 'cocotb.test', 'cocotb.test', ([], {}), '()\n', (11065, 11067), False, 'import cocotb\n'), ((2128, 2151), 'random.randint', 'random.randint', (['(1)', '(1513)'], {}), '(1, 1513)\n', (2142, 2151), False, 'import random\n'), ((11379, 11396), 'lib.axilite.AXI_Lite_Writer', 'AXI_Lite_Writer', ([], {}), '(... |
import errno
import os
import locale
from datetime import datetime
try:
import pytz
HAS_PYTZ = True
except ImportError:
HAS_PYTZ = False
from i3pystatus import IntervalModule
class Clock(IntervalModule):
"""
This class shows a clock.
.. note:: Optionally requires `pytz` for time zone data w... | [
"os.environ.get",
"pytz.tzfile.build_tzinfo",
"pytz.timezone",
"locale.setlocale",
"datetime.datetime.now",
"locale.getlocale"
] | [((1667, 1698), 'os.environ.get', 'os.environ.get', (['"""LC_TIME"""', 'None'], {}), "('LC_TIME', None)\n", (1681, 1698), False, 'import os\n'), ((4702, 4754), 'datetime.datetime.now', 'datetime.now', (['self.format[self.current_format_id][1]'], {}), '(self.format[self.current_format_id][1])\n', (4714, 4754), False, 'f... |
from selenium.webdriver.common.keys import Keys
from selenium import webdriver
from django.test import LiveServerTestCase
from django.test import TestCase
from django.urls import reverse
from accounts.models import UserProfileInfo, User
from admin_app.models import Magazine, Truck
from accounts.forms import UserForm, U... | [
"django.test.Client",
"selenium.webdriver.Firefox",
"accounts.models.User.objects.count",
"accounts.models.User.objects.create",
"django.urls.reverse",
"admin_app.models.Magazine.objects.create",
"accounts.models.User.objects.get",
"accounts.models.UserProfileInfo.objects.create",
"accounts.models.U... | [((542, 662), 'accounts.models.User.objects.create', 'User.objects.create', ([], {'username': '"""user1"""', 'first_name': '"""Name1"""', 'last_name': '"""Last1"""', 'email': '"""<EMAIL>"""', 'password': '"""<PASSWORD>"""'}), "(username='user1', first_name='Name1', last_name='Last1',\n email='<EMAIL>', password='<PA... |
from flask_restx import fields
from application.api.mongodb import *
freshman_model = mongodb.model('freshman', {
'matricola': fields.String
})
id_conversation_model = mongodb.model('id_conversation_model', {
'id_conversation': fields.String
})
send_message_model = mongodb.model('insert_message', {
'id_c... | [
"flask_restx.fields.Nested"
] | [((1005, 1037), 'flask_restx.fields.Nested', 'fields.Nested', (['get_message_model'], {}), '(get_message_model)\n', (1018, 1037), False, 'from flask_restx import fields\n')] |
import re
import sys
meetup_svg = '.github/images/meetup.svg'
readme_md = 'README.md'
conf_py = 'docs/conf.py'
def rm_announce():
# remove all announcement
with open(readme_md) as fp:
_old = fp.read()
_new = re.sub(
r'(<!--startmsg-->\s*?\n).*(\n\s*?<!--endmsg-->)',
rf... | [
"re.sub"
] | [((235, 339), 're.sub', 're.sub', (['"""(<!--startmsg-->\\\\s*?\\\\n).*(\\\\n\\\\s*?<!--endmsg-->)"""', 'f"""\\\\g<1>\\\\g<2>"""', '_old'], {'flags': 're.DOTALL'}), "('(<!--startmsg-->\\\\s*?\\\\n).*(\\\\n\\\\s*?<!--endmsg-->)',\n f'\\\\g<1>\\\\g<2>', _old, flags=re.DOTALL)\n", (241, 339), False, 'import re\n'), ((5... |
import copy
import os
from functools import reduce
from pathlib import Path
import chainer
import chainer.functions as F
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import six
from chainer import configuration, cuda, function
from chainer import report... | [
"matplotlib.pyplot.title",
"matplotlib.pyplot.clf",
"numpy.argmax",
"chainer.reporter.Reporter",
"pathlib.Path",
"chainer.no_backprop_mode",
"numpy.mean",
"six.iteritems",
"pandas.DataFrame",
"chainer.functions.softmax_cross_entropy",
"chainer.functions.sigmoid_cross_entropy",
"chainer.cuda.to... | [((140, 161), 'matplotlib.use', 'matplotlib.use', (['"""Agg"""'], {}), "('Agg')\n", (154, 161), False, 'import matplotlib\n'), ((855, 904), 'sklearn.metrics.roc_curve', 'metrics.roc_curve', ([], {'y_true': 'y_true', 'y_score': 'y_score'}), '(y_true=y_true, y_score=y_score)\n', (872, 904), False, 'from sklearn import me... |
# -*- coding: utf-8 -*-
"""
@author: Manuel
"""
import socket
import time
import sys
import json
import sensor_version.config as config
from IoT_Client_functions import read_data_from_sensor
from sensor_version.data_message import message
udp_timeout = 2
udp_delay = 1
if len(sys.argv) != 2:
print('Error: need cl... | [
"sensor_version.data_message.message",
"socket.socket",
"json.dumps",
"time.sleep",
"time.time_ns",
"IoT_Client_functions.read_data_from_sensor",
"sys.exit"
] | [((338, 349), 'sys.exit', 'sys.exit', (['(1)'], {}), '(1)\n', (346, 349), False, 'import sys\n'), ((589, 612), 'IoT_Client_functions.read_data_from_sensor', 'read_data_from_sensor', ([], {}), '()\n', (610, 612), False, 'from IoT_Client_functions import read_data_from_sensor\n'), ((624, 675), 'sensor_version.data_messag... |
import time
import random
value = random.randint(0, 1000)
while True:
if random.randint(0, 100) > 50:
print("lose everything")
| [
"random.randint"
] | [((35, 58), 'random.randint', 'random.randint', (['(0)', '(1000)'], {}), '(0, 1000)\n', (49, 58), False, 'import random\n'), ((79, 101), 'random.randint', 'random.randint', (['(0)', '(100)'], {}), '(0, 100)\n', (93, 101), False, 'import random\n')] |
from django.db import models
# Create your models here.
class ProjectCat(models.Model):
ProjectId = models.IntegerField()
CarId = models.IntegerField()
CartName = models.CharField(max_length=225)
class ApiName(models.Model):
ProjectId = models.IntegerField()
CarId = models.IntegerField()
Api... | [
"django.db.models.CharField",
"django.db.models.IntegerField"
] | [((107, 128), 'django.db.models.IntegerField', 'models.IntegerField', ([], {}), '()\n', (126, 128), False, 'from django.db import models\n'), ((141, 162), 'django.db.models.IntegerField', 'models.IntegerField', ([], {}), '()\n', (160, 162), False, 'from django.db import models\n'), ((178, 210), 'django.db.models.CharFi... |
# -*- coding: utf-8 -*-
from django import forms
from .models import PoliticalClasification
class PoliticalClasificationForm(forms.ModelForm):
class Meta:
model = PoliticalClasification
fields = [
'political',
'content',
'numbers'
]
... | [
"django.forms.CharField",
"django.forms.DecimalField"
] | [((387, 404), 'django.forms.CharField', 'forms.CharField', ([], {}), '()\n', (402, 404), False, 'from django import forms\n'), ((419, 436), 'django.forms.CharField', 'forms.CharField', ([], {}), '()\n', (434, 436), False, 'from django import forms\n'), ((451, 471), 'django.forms.DecimalField', 'forms.DecimalField', ([]... |
import datetime
import django
from django.db import IntegrityError
from django.test import TestCase
import ippon.models
import ippon.models.club as cl
import ippon.models.cup_fight
import ippon.models.cup_fight as cfm
import ippon.models.fight
import ippon.models.player as plm
import ippon.models.team_fight as tfm
im... | [
"datetime.date",
"ippon.models.team_fight.TeamFight.objects.filter",
"ippon.models.club.Club.objects.create"
] | [((5374, 5469), 'ippon.models.club.Club.objects.create', 'cl.Club.objects.create', ([], {'name': '"""cn1"""', 'webpage': '"""http://cw1.co"""', 'description': '"""cd1"""', 'city': '"""cc1"""'}), "(name='cn1', webpage='http://cw1.co', description=\n 'cd1', city='cc1')\n", (5396, 5469), True, 'import ippon.models.club... |
import io
import pickle
import sys
import unittest
from satella.instrumentation import Traceback
class TestTraceback(unittest.TestCase):
def test_no_exc(self):
tb = Traceback()
byte = io.BytesIO()
byte2 = tb.pickle()
tb.pickle_to(byte)
byte.seek(0)
tb2 = Traceback.... | [
"pickle.loads",
"satella.instrumentation.Traceback.from_json",
"io.BytesIO",
"satella.instrumentation.Traceback.from_pickle",
"sys._current_frames",
"satella.instrumentation.Traceback",
"pickle.dumps"
] | [((180, 191), 'satella.instrumentation.Traceback', 'Traceback', ([], {}), '()\n', (189, 191), False, 'from satella.instrumentation import Traceback\n'), ((207, 219), 'io.BytesIO', 'io.BytesIO', ([], {}), '()\n', (217, 219), False, 'import io\n'), ((310, 337), 'satella.instrumentation.Traceback.from_pickle', 'Traceback.... |
# Generated by Django 2.1.1 on 2019-01-16 09:49
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('data_ingestion_service', '0001_initial'),
]
operations = [
migrations.AddField(
model_name='storedfiles',
name='cate... | [
"django.db.models.CharField"
] | [((345, 462), 'django.db.models.CharField', 'models.CharField', ([], {'blank': '(True)', 'choices': "[('offline_survey_data', 'Offline Survey Data')]", 'max_length': '(255)', 'null': '(True)'}), "(blank=True, choices=[('offline_survey_data',\n 'Offline Survey Data')], max_length=255, null=True)\n", (361, 462), False... |
from __future__ import print_function
import numpy
OPENOPT = SCIPY = True
try:
from openopt import NLP
except ImportError:
OPENOPT = False
try:
from scipy.optimize import minimize
except ImportError:
SCIPY = False
SCIPY_LOCAL_SOLVERS = ['Nelder-Mead', 'Powell', 'L-BFGS-B', 'TNC', ... | [
"numpy.random.uniform",
"scipy.optimize.minimize",
"numpy.sum",
"numpy.abs",
"numpy.argmax",
"numpy.asarray",
"os.system",
"numpy.where",
"numpy.linalg.norm",
"numpy.atleast_1d",
"numpy.sqrt"
] | [((4282, 4302), 'numpy.atleast_1d', 'numpy.atleast_1d', (['x0'], {}), '(x0)\n', (4298, 4302), False, 'import numpy\n'), ((5366, 5384), 'numpy.asarray', 'numpy.asarray', (['low'], {}), '(low)\n', (5379, 5384), False, 'import numpy\n'), ((5395, 5412), 'numpy.asarray', 'numpy.asarray', (['up'], {}), '(up)\n', (5408, 5412)... |
# @PascalPuchtler
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agreed to in writing, software
# dis... | [
"Controller.MoveController.CarModel.CarModel",
"numpy.clip"
] | [((1120, 1130), 'Controller.MoveController.CarModel.CarModel', 'CarModel', ([], {}), '()\n', (1128, 1130), False, 'from Controller.MoveController.CarModel import CarModel\n'), ((3953, 4012), 'numpy.clip', 'np.clip', (['m', '(-self.maxDriveableSlope)', 'self.maxDriveableSlope'], {}), '(m, -self.maxDriveableSlope, self.m... |
"""
This module downloads a lot of songs from anime music quiz
Dependencies:
ffmpeg
selenium
Firefox
geckodriver
"""
import os
import re
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.common.action_chains import ActionChains
import time
import json
from pathlib im... | [
"json.loads",
"selenium.webdriver.Firefox",
"time.sleep",
"pathlib.Path",
"subprocess.call",
"sqlite3.connect",
"re.compile"
] | [((3107, 3120), 'time.sleep', 'time.sleep', (['(3)'], {}), '(3)\n', (3117, 3120), False, 'import time\n'), ((3271, 3294), 'json.loads', 'json.loads', (['pure_string'], {}), '(pure_string)\n', (3281, 3294), False, 'import json\n'), ((3940, 4000), 'selenium.webdriver.Firefox', 'webdriver.Firefox', ([], {'executable_path'... |
import os
import sys
sys.path.append(os.path.dirname(os.path.dirname(os.path.realpath(__file__))))
from lib.sender import send
from lib.core import utils
def login(options):
url = options.get('remote_api') + "/auth/api/token/"
body = {
"username": options.get('credentials')[0],
"password": op... | [
"os.path.realpath",
"lib.core.utils.print_good",
"lib.sender.send.send_post",
"lib.core.utils.print_bad"
] | [((362, 401), 'lib.sender.send.send_post', 'send.send_post', (['url', 'body'], {'is_json': '(True)'}), '(url, body, is_json=True)\n', (376, 401), False, 'from lib.sender import send\n'), ((594, 634), 'lib.core.utils.print_bad', 'utils.print_bad', (['"""Authentication failed"""'], {}), "('Authentication failed')\n", (60... |
""" Platform views for editorial app.
editorial/views/platformviews.py
"""
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from braces.views import LoginRequiredMixin
from django.conf import settings
from django.core.urlresolvers import reverse
from django.views.generic import FormVi... | [
"django.core.urlresolvers.reverse"
] | [((1782, 1839), 'django.core.urlresolvers.reverse', 'reverse', (['"""user_edit"""'], {'kwargs': "{'pk': self.request.user.id}"}), "('user_edit', kwargs={'pk': self.request.user.id})\n", (1789, 1839), False, 'from django.core.urlresolvers import reverse\n')] |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Thu Dec 27 00:52:19 2018
@author: xavier.qiu
"""
from common.load import *
from common.pd_util import *
from common.preprocess import *
from common.util import *
from keras.preprocessing.text import Tokenizer
from keras.preprocessing.sequence import pad_se... | [
"pickle.dump",
"keras.preprocessing.sequence.pad_sequences",
"gc.collect",
"keras.preprocessing.text.Tokenizer",
"pickle.load",
"numpy.random.normal"
] | [((2340, 2352), 'gc.collect', 'gc.collect', ([], {}), '()\n', (2350, 2352), False, 'import gc\n'), ((3345, 3403), 'numpy.random.normal', 'np.random.normal', (['emb_mean', 'emb_std', '(len_voc, embed_size)'], {}), '(emb_mean, emb_std, (len_voc, embed_size))\n', (3361, 3403), True, 'import numpy as np\n'), ((3741, 3786),... |
"""
Copyright (c) 2015 <NAME> and Bamboo HR LLC
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in w... | [
"rapid.lib.framework.ioc.IOC.get_class_instance"
] | [((1216, 1262), 'rapid.lib.framework.ioc.IOC.get_class_instance', 'IOC.get_class_instance', (['TestClass', '"""Something"""'], {}), "(TestClass, 'Something')\n", (1238, 1262), False, 'from rapid.lib.framework.ioc import IOC\n')] |
import numpy as np
# Sizes relevant to default camera frame
ASPECT_RATIO = 16.0 / 9.0
FRAME_HEIGHT = 8.0
FRAME_WIDTH = FRAME_HEIGHT * ASPECT_RATIO
FRAME_Y_RADIUS = FRAME_HEIGHT / 2
FRAME_X_RADIUS = FRAME_WIDTH / 2
DEFAULT_PIXEL_HEIGHT = 1080
DEFAULT_PIXEL_WIDTH = 1920
DEFAULT_FRAME_RATE = 30
SMALL_BUFF = 0.1
MED_SMA... | [
"numpy.array"
] | [((567, 592), 'numpy.array', 'np.array', (['(0.0, 0.0, 0.0)'], {}), '((0.0, 0.0, 0.0))\n', (575, 592), True, 'import numpy as np\n'), ((595, 620), 'numpy.array', 'np.array', (['(0.0, 1.0, 0.0)'], {}), '((0.0, 1.0, 0.0))\n', (603, 620), True, 'import numpy as np\n'), ((625, 651), 'numpy.array', 'np.array', (['(0.0, -1.0... |
from flask import Flask, render_template
from datetime import date
app = Flask(__name__)
@app.route("/")
def check():
today = date.today()
newyearcheck = today.month == 1 and today.day == 1
return render_template("index.html", newyearcheck=newyearcheck)
| [
"flask.Flask",
"datetime.date.today",
"flask.render_template"
] | [((74, 89), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (79, 89), False, 'from flask import Flask, render_template\n'), ((133, 145), 'datetime.date.today', 'date.today', ([], {}), '()\n', (143, 145), False, 'from datetime import date\n'), ((212, 268), 'flask.render_template', 'render_template', (['"""in... |
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
# SPDX-License-Identifier: MIT-0
#
# Permission is hereby granted, free of charge, to any person obtaining a copy of this
# software and associated documentation files (the "Software"), to deal in the Software
# without restriction, including... | [
"sagemaker.feature_store.feature_group.FeatureGroup",
"xgboost.plot_importance",
"matplotlib.pyplot.show",
"json.loads",
"base64.b64decode",
"sagemaker.Session",
"boto3.session.Session"
] | [((1442, 1465), 'boto3.session.Session', 'boto3.session.Session', ([], {}), '()\n', (1463, 1465), False, 'import boto3\n'), ((4278, 4400), 'xgboost.plot_importance', 'plot_importance', (['res'], {'max_num_features': 'maxfeats', 'importance_type': 'f', 'title': "('Feature Importance: ' + f)", 'color': '"""#4daf4a"""'}),... |
import numpy as np
from net import Net
from functional import *
from os import remove
temp_path = "./model/param"
def save_model(net: Net, name: str):
'''
将网络信息保存
parameters
----------
net : 神经网络类
name : 文件名,文件将被保存到model文件夹中的指定名称文件中
return
------
1 : 表示保存成功
'''
path = ".... | [
"os.remove",
"numpy.load",
"numpy.savetxt",
"numpy.zeros",
"net.Net",
"numpy.loadtxt"
] | [((1013, 1030), 'os.remove', 'remove', (['temp_path'], {}), '(temp_path)\n', (1019, 1030), False, 'from os import remove\n'), ((2430, 2447), 'os.remove', 'remove', (['temp_path'], {}), '(temp_path)\n', (2436, 2447), False, 'from os import remove\n'), ((1754, 1828), 'net.Net', 'Net', (['*layer_info'], {'criterion': 'cri... |
# Basic truss example in Openseespy:
import openseespy.opensees as ops
import openseespy.postprocessing.Get_Rendering as opsplt
##############################################################################
##### Define units in SI #####
#########################... | [
"openseespy.opensees.analysis",
"openseespy.opensees.integrator",
"openseespy.opensees.initialize",
"openseespy.opensees.load",
"openseespy.opensees.node",
"openseespy.opensees.numberer",
"openseespy.opensees.wipe",
"openseespy.opensees.model",
"openseespy.opensees.pattern",
"openseespy.postproces... | [((2757, 2767), 'openseespy.opensees.wipe', 'ops.wipe', ([], {}), '()\n', (2765, 2767), True, 'import openseespy.opensees as ops\n'), ((2804, 2844), 'openseespy.opensees.model', 'ops.model', (['"""basic"""', '"""-ndm"""', '(2)', '"""-ndf"""', '(3)'], {}), "('basic', '-ndm', 2, '-ndf', 3)\n", (2813, 2844), True, 'import... |
from __future__ import print_function
import pandas as pd
import json
import sys
import requests
_api_version = str('0.0.1')
class MagpieServer:
"""Object to store how to connect to a server running Magpie"""
_url = None
""" URL of server """
_models = None
""" Cached information about models... | [
"pandas.DataFrame",
"requests.request"
] | [((1069, 1133), 'requests.request', 'requests.request', ([], {'method': 'method', 'url': '(self._url + path)', 'data': 'data'}), '(method=method, url=self._url + path, data=data)\n', (1085, 1133), False, 'import requests\n'), ((3582, 3677), 'pandas.DataFrame', 'pd.DataFrame', (["[x['attributes'] for x in results['entri... |
#!python
# coding=utf-8
import os
import unittest
import tempfile
from os.path import join as jn
from os.path import dirname as dn
import pytest
from pocean.dsg import ContiguousRaggedTrajectory, get_calculated_attributes
from pocean.tests.dsg.test_new import test_is_mine
import logging
from pocean import logger
logg... | [
"os.remove",
"pocean.tests.dsg.test_new.test_is_mine",
"tempfile.mkstemp",
"pocean.dsg.get_calculated_attributes",
"pocean.dsg.ContiguousRaggedTrajectory.from_dataframe",
"os.path.dirname",
"logging.StreamHandler",
"pocean.dsg.ContiguousRaggedTrajectory",
"os.close"
] | [((363, 386), 'logging.StreamHandler', 'logging.StreamHandler', ([], {}), '()\n', (384, 386), False, 'import logging\n'), ((658, 702), 'pocean.tests.dsg.test_new.test_is_mine', 'test_is_mine', (['ContiguousRaggedTrajectory', 'fp'], {}), '(ContiguousRaggedTrajectory, fp)\n', (670, 702), False, 'from pocean.tests.dsg.tes... |
import re
from satosa.micro_services.processors.base_processor import BaseProcessor
class LegacyProcessor:
@staticmethod
def codice_fiscale_rs(schacpersonaluniqueids=[], nationprefix=False, nationprefix_sep=':'):
if isinstance(schacpersonaluniqueids, str):
schacpersonaluniqueids = [schacpe... | [
"re.match"
] | [((618, 653), 're.match', 're.match', (['rs_regexp', 'uniqueid', 're.I'], {}), '(rs_regexp, uniqueid, re.I)\n', (626, 653), False, 'import re\n'), ((1481, 1522), 're.match', 're.match', (['spid_regexp', 'fiscalNumber', 're.I'], {}), '(spid_regexp, fiscalNumber, re.I)\n', (1489, 1522), False, 'import re\n'), ((2504, 253... |
#!/usr/bin/env python
from __future__ import print_function
import subprocess
# stack two Inkscape generated files
subprocess.check_call(
'../svg_stack.py --direction=h --margin=100 red_ball.svg blue_triangle.svg > shapes_test.svg',
shell=True)
# Inkscape files don't pass xmllint -- don't test
print('You sh... | [
"subprocess.check_call"
] | [((117, 255), 'subprocess.check_call', 'subprocess.check_call', (['"""../svg_stack.py --direction=h --margin=100 red_ball.svg blue_triangle.svg > shapes_test.svg"""'], {'shell': '(True)'}), "(\n '../svg_stack.py --direction=h --margin=100 red_ball.svg blue_triangle.svg > shapes_test.svg'\n , shell=True)\n", (138,... |
#!/usr/bin/env python3
import os
import concurrent.futures
from time import time
from utils import load_csv, write_results, check_open_port
# https://docs.python.org/3/library/concurrent.futures.html#threadpoolexecutor-example
start = time()
results = {}
top_sites = f'{os.path.dirname(os.path.realpath(__file__))}/... | [
"os.path.realpath",
"utils.write_results",
"utils.load_csv",
"time.time"
] | [((240, 246), 'time.time', 'time', ([], {}), '()\n', (244, 246), False, 'from time import time\n'), ((993, 1026), 'utils.write_results', 'write_results', (['results', '"""futures"""'], {}), "(results, 'futures')\n", (1006, 1026), False, 'from utils import load_csv, write_results, check_open_port\n'), ((1033, 1039), 'ti... |
from typing import List, Optional
from fastapi import APIRouter, Body, Depends
from watchmen_auth import PrincipalService
from watchmen_meta.common import ask_meta_storage, ask_snowflake_generator
from watchmen_meta.system import ExternalWriterService
from watchmen_model.admin import UserRole
from watchmen_model.comm... | [
"watchmen_utilities.is_blank",
"watchmen_rest.util.raise_404",
"watchmen_rest_doll.util.trans_readonly",
"fastapi.Body",
"watchmen_rest.util.raise_400",
"watchmen_meta.common.ask_meta_storage",
"watchmen_meta.common.ask_snowflake_generator",
"watchmen_rest_doll.doll.ask_tuple_delete_enabled",
"watch... | [((725, 736), 'fastapi.APIRouter', 'APIRouter', ([], {}), '()\n', (734, 736), False, 'from fastapi import APIRouter, Body, Depends\n'), ((1166, 1198), 'fastapi.Depends', 'Depends', (['get_any_admin_principal'], {}), '(get_any_admin_principal)\n', (1173, 1198), False, 'from fastapi import APIRouter, Body, Depends\n'), (... |
import asyncio
import json
import websockets
from .exceptions import InvalidServer, ConnectionClosed
from .utils import maybe_await
# noinspection SpellCheckingInspection
class RconConnector:
# noinspection PyTypeChecker
def __init__(self, host, port, password, message_callback=None, console_callback=None):
... | [
"websockets.connect",
"json.loads",
"asyncio.sleep"
] | [((1298, 1336), 'websockets.connect', 'websockets.connect', (['self.uri'], {}), '(self.uri, **kwargs)\n', (1316, 1336), False, 'import websockets\n'), ((3149, 3165), 'json.loads', 'json.loads', (['resp'], {}), '(resp)\n', (3159, 3165), False, 'import json\n'), ((2454, 2492), 'asyncio.sleep', 'asyncio.sleep', (['((retry... |
"""State Generator"""
from lesson12_projects.house3.data.const import (
MY_ROOM,
OUT,
CLOSE_DOOR,
OPEN_DOOR,
STAIRS,
)
from lesson13n2.states.myroom import MyroomState
from lesson13n2.states.out import OutState
from lesson13n2.states.out_closedoor import OutClosedoorState
from lesson13n2.states.out_... | [
"lesson13n2.states.out.OutState",
"lesson13n2.states.myroom.MyroomState",
"lesson13n2.states.out_closedoor.OutClosedoorState",
"lesson13n2.states.stairs.StairsState",
"lesson13n2.states.out_opendoor.OutOpendoorState"
] | [((649, 662), 'lesson13n2.states.stairs.StairsState', 'StairsState', ([], {}), '()\n', (660, 662), False, 'from lesson13n2.states.stairs import StairsState\n'), ((685, 698), 'lesson13n2.states.myroom.MyroomState', 'MyroomState', ([], {}), '()\n', (696, 698), False, 'from lesson13n2.states.myroom import MyroomState\n'),... |
from __future__ import unicode_literals
from django.contrib.auth.decorators import login_required
from django.db.models import F
from django.utils.decorators import method_decorator
from django.views.generic import ListView
from wiki import models
from wiki.core.paginator import WikiPaginator
class GlobalHistory(Lis... | [
"django.db.models.F",
"django.utils.decorators.method_decorator"
] | [((533, 565), 'django.utils.decorators.method_decorator', 'method_decorator', (['login_required'], {}), '(login_required)\n', (549, 565), False, 'from django.utils.decorators import method_decorator\n'), ((939, 946), 'django.db.models.F', 'F', (['"""id"""'], {}), "('id')\n", (940, 946), False, 'from django.db.models im... |
import unittest
from torch import rand
from tensorneko.layer import PatchEmbedding2d
class TestPatching(unittest.TestCase):
# TODO
pass
class TestPatchEmbedding2d(unittest.TestCase):
def test_simple_patching(self):
# test input for 64x64 RGB image batches
b, c, h, w = (8, 3, 64, 64)
... | [
"tensorneko.layer.PatchEmbedding2d",
"torch.rand"
] | [((331, 347), 'torch.rand', 'rand', (['b', 'c', 'h', 'w'], {}), '(b, c, h, w)\n', (335, 347), False, 'from torch import rand\n'), ((471, 504), 'tensorneko.layer.PatchEmbedding2d', 'PatchEmbedding2d', (['(c, h, w)', 'p', 'e'], {}), '((c, h, w), p, e)\n', (487, 504), False, 'from tensorneko.layer import PatchEmbedding2d\... |
from flask_sqlalchemy import SQLAlchemy
from onto_app import db
from onto_app.helper import add_new_ontologies
class users(db.Model):
__tabelname__ = 'users'
id = db.Column(db.String, primary_key=True)
username = db.Column(db.String(200), unique=True, nullable=False)
# password = db.Column(db.String(20... | [
"onto_app.db.create_all",
"onto_app.db.relationship",
"onto_app.db.Column",
"onto_app.helper.add_new_ontologies",
"onto_app.db.String",
"onto_app.db.ForeignKey"
] | [((3381, 3401), 'onto_app.helper.add_new_ontologies', 'add_new_ontologies', ([], {}), '()\n', (3399, 3401), False, 'from onto_app.helper import add_new_ontologies\n'), ((172, 210), 'onto_app.db.Column', 'db.Column', (['db.String'], {'primary_key': '(True)'}), '(db.String, primary_key=True)\n', (181, 210), False, 'from ... |
from django.db import models
'''
SuperUser information:
User: Sandra
Email: <EMAIL>
Password: <PASSWORD>
'''
# Create your models here.
class Topic(models.Model):
top_name = models.CharField(max_length=264, unique=True)
def __str__(self) -> str:
return self.top_name
class Webpage(models.Model):
topic... | [
"django.db.models.CharField",
"django.db.models.URLField",
"django.db.models.ForeignKey",
"django.db.models.DateField"
] | [((177, 222), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(264)', 'unique': '(True)'}), '(max_length=264, unique=True)\n', (193, 222), False, 'from django.db import models\n'), ((323, 373), 'django.db.models.ForeignKey', 'models.ForeignKey', (['Topic'], {'on_delete': 'models.CASCADE'}), '(Top... |
import os
from flask.ext.dotenv import DotEnv
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
class Config(object):
"""Main configuration class"""
DEBUG = False
TESTING = False
CSRF_ENABLED = True
SQLALCHEMY_DATABASE_URI = os.environ.get('DATABASE_URL')
SQLALCHEMY_TRACK... | [
"os.path.abspath",
"flask.ext.dotenv.DotEnv",
"os.environ.get",
"os.path.join",
"os.getenv"
] | [((269, 299), 'os.environ.get', 'os.environ.get', (['"""DATABASE_URL"""'], {}), "('DATABASE_URL')\n", (283, 299), False, 'import os\n'), ((359, 383), 'os.environ.get', 'os.environ.get', (['"""SECRET"""'], {}), "('SECRET')\n", (373, 383), False, 'import os\n'), ((963, 994), 'os.getenv', 'os.getenv', (['"""TRAVIS_BUILD""... |
# -*- coding: utf-8 -*-
"""
ZenMaxBuilder Copyright © 2021 darkmaster@grm34 https://github.com/grm34
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/l... | [
"modules.manager.options.options_manager",
"modules.manager.json.load_json_file",
"modules.manager.error.prevent_defconfig_folder",
"modules.manager.error.prevent_out_folder",
"modules.main.logger.app_logger",
"modules.main.helper.app_helper",
"modules.session.requirements.session_requirements",
"modu... | [((4305, 4331), 'modules.manager.json.load_json_file', 'load_json_file', (['"""app.json"""'], {}), "('app.json')\n", (4319, 4331), False, 'from modules.manager.json import load_json_file\n'), ((4399, 4428), 'modules.manager.json.load_json_file', 'load_json_file', (['"""themes.json"""'], {}), "('themes.json')\n", (4413,... |
"""Common options and utils that can me used in commandline utils"""
import logging
import argparse
import sys
RESOLVED_TOOL_CONTRACT_OPTION = "--resolved-tool-contract"
EMIT_TOOL_CONTRACT_OPTION = "--emit-tool-contract"
def add_debug_option(p):
p.add_argument("--pdb", action="store_true", default=False,
... | [
"sys.stdout.write",
"logging.getLevelName",
"sys.exit"
] | [((1158, 1193), 'logging.getLevelName', 'logging.getLevelName', (['default_level'], {}), '(default_level)\n', (1178, 1193), False, 'import logging\n'), ((3847, 3875), 'sys.stdout.write', 'sys.stdout.write', (["(msg + '\\n')"], {}), "(msg + '\\n')\n", (3863, 3875), False, 'import sys\n'), ((3888, 3899), 'sys.exit', 'sys... |
from contentbase.upgrader import upgrade_step
@upgrade_step('annotation', '1', '2')
def annotation_1_2(value, system):
# https://github.com/ClinGen/clincoded/issues/453
value['status'] = 'in progress'
@upgrade_step('annotation', '2', '3')
def annotation_2_3(value, system):
# https://github.com/ClinGen/c... | [
"contentbase.upgrader.upgrade_step"
] | [((49, 85), 'contentbase.upgrader.upgrade_step', 'upgrade_step', (['"""annotation"""', '"""1"""', '"""2"""'], {}), "('annotation', '1', '2')\n", (61, 85), False, 'from contentbase.upgrader import upgrade_step\n'), ((214, 250), 'contentbase.upgrader.upgrade_step', 'upgrade_step', (['"""annotation"""', '"""2"""', '"""3""... |
import multiprocessing as mp
import pandas as pd
from selenium import webdriver
from time import sleep
import config
import json
from utils import access_url
import argparse
def crawler(cate_name,item_links):
driver = webdriver.Chrome()
fb_li = []
counter = 0
for item_link in item_links:
access_url(driver,item_... | [
"pandas.DataFrame",
"json.load",
"argparse.ArgumentParser",
"selenium.webdriver.Chrome",
"multiprocessing.Pool"
] | [((221, 239), 'selenium.webdriver.Chrome', 'webdriver.Chrome', ([], {}), '()\n', (237, 239), False, 'from selenium import webdriver\n'), ((1061, 1118), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Multiprocessing!!!"""'}), "(description='Multiprocessing!!!')\n", (1084, 1118), False, 'i... |
from functools import partial
from typing import List, Sequence, Tuple
import einops
import torch
import torch.nn.functional as F
from pytorch_wavelets import DWTForward, DWTInverse
from torch import nn
from mmderain.models.common import get_rcp, make_layer, sizeof
from mmderain.models.layers import SELayer
from mmde... | [
"mmderain.models.registry.BACKBONES.register_module",
"functools.partial",
"torch.nn.ReLU",
"torch.nn.ConvTranspose2d",
"mmderain.models.common.get_rcp",
"torch.nn.ReflectionPad2d",
"mmderain.models.common.make_layer",
"torch.nn.Conv2d",
"torch.split",
"torch.cat",
"torch.sigmoid",
"pytorch_wa... | [((7589, 7616), 'mmderain.models.registry.BACKBONES.register_module', 'BACKBONES.register_module', ([], {}), '()\n', (7614, 7616), False, 'from mmderain.models.registry import BACKBONES\n'), ((1661, 1682), 'torch.nn.ReLU', 'nn.ReLU', ([], {'inplace': '(True)'}), '(inplace=True)\n', (1668, 1682), False, 'from torch impo... |
import ipywidgets as ipw
def get_start_widget(appbase, jupbase):
#http://fontawesome.io/icons/
template = """
<table>
<tr>
<th style="text-align:center"></th>
<th style="width:70px" rowspan=2></th>
<th style="text-align:center"></th>
<th style="width:70px" rowspan=2></th... | [
"ipywidgets.HTML"
] | [((965, 979), 'ipywidgets.HTML', 'ipw.HTML', (['html'], {}), '(html)\n', (973, 979), True, 'import ipywidgets as ipw\n')] |
###############################
#
# Created by <NAME>
# 3/16/2021
#
###############################
import unittest
import torch as t
import ffeat
from ffeat.strategies import mutation
class ReplaceWithNormalTest(unittest.TestCase):
def test_norm(self):
m = mutation.Replace(t.distributions.Normal(0.0, 5.0... | [
"unittest.main",
"torch.ones",
"torch.randn",
"torch.cuda.is_available",
"torch.distributions.Normal",
"ffeat.utils.decay.Linear"
] | [((2861, 2876), 'unittest.main', 'unittest.main', ([], {}), '()\n', (2874, 2876), False, 'import unittest\n'), ((343, 363), 'torch.randn', 't.randn', (['(1000, 400)'], {}), '((1000, 400))\n', (350, 363), True, 'import torch as t\n'), ((615, 635), 'torch.randn', 't.randn', (['(1000, 400)'], {}), '((1000, 400))\n', (622,... |
from rest_framework.views import APIView
from rest_framework.response import Response
from rest_framework import status
import eikon as ek
from pandas import DataFrame
import json
from datetime import datetime
import os
import dateutil
#### SET EIKON APP KEY ####
ek.set_app_key('SET_APP_KEY_HERE')
##### NEWS #####
cl... | [
"os.makedirs",
"datetime.datetime.today",
"os.path.dirname",
"eikon.get_news_headlines",
"os.path.exists",
"eikon.get_news_story",
"rest_framework.response.Response",
"eikon.get_timeseries",
"eikon.set_app_key",
"eikon.get_data"
] | [((265, 299), 'eikon.set_app_key', 'ek.set_app_key', (['"""SET_APP_KEY_HERE"""'], {}), "('SET_APP_KEY_HERE')\n", (279, 299), True, 'import eikon as ek\n'), ((1963, 1991), 'rest_framework.response.Response', 'Response', (['result'], {'status': '(200)'}), '(result, status=200)\n', (1971, 1991), False, 'from rest_framewor... |
from flask import Flask
from dataclasses import dataclass, field
from typing import List, Dict
app = Flask(__name__)
@dataclass
class Human:
name: str
pets: List[str] = field(default_factory=list)
def get_humans() -> Dict[str, Human]:
humans = [
Human('<NAME>', pets=['Bork the Dog',
... | [
"dataclasses.field",
"flask.Flask"
] | [((102, 117), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (107, 117), False, 'from flask import Flask\n'), ((180, 207), 'dataclasses.field', 'field', ([], {'default_factory': 'list'}), '(default_factory=list)\n', (185, 207), False, 'from dataclasses import dataclass, field\n')] |
import os
from Crypto.Cipher import AES
from Crypto.Hash import SHA256
from Crypto import Random
from tkinter import *
from tkinter.messagebox import *
from tkinter.ttk import Label
import sys
import time
from threading import Thread
import webbrowser
import tkinter as tk
Kinter = tk()
Kinter.title("Kinter Cryptor")
... | [
"os.path.getsize",
"tkinter",
"Crypto.Random.new",
"Crypto.Cipher.AES.new"
] | [((283, 287), 'tkinter', 'tk', ([], {}), '()\n', (285, 287), True, 'import tkinter as tk\n'), ((516, 546), 'Crypto.Cipher.AES.new', 'AES.new', (['key', 'AES.MODE_CBC', 'IV'], {}), '(key, AES.MODE_CBC, IV)\n', (523, 546), False, 'from Crypto.Cipher import AES\n'), ((1231, 1261), 'Crypto.Cipher.AES.new', 'AES.new', (['ke... |
"""
Module for vega-admin test models
"""
from django.db import models
from django.utils.translation import ugettext as _
class Artist(models.Model):
"""
Artist Model class
"""
name = models.CharField(_("Name"), max_length=100)
class Meta:
ordering = ["name"]
verbose_name = "Arti... | [
"django.utils.translation.ugettext"
] | [((220, 229), 'django.utils.translation.ugettext', '_', (['"""Name"""'], {}), "('Name')\n", (221, 229), True, 'from django.utils.translation import ugettext as _\n'), ((854, 863), 'django.utils.translation.ugettext', '_', (['"""Name"""'], {}), "('Name')\n", (855, 863), True, 'from django.utils.translation import ugette... |
from skmob.utils import gislib
import math
class TestClustering:
def setup_method(self):
self.point_1 = (43.8430139, 10.5079940)
self.point_2 = (43.5442700, 10.3261500)
self.decimal = 43.8430139
self.DMS = (43, 50, 34.85)
def test_get_distance(self):
output = gislib.... | [
"skmob.utils.gislib.DMSToDecimal",
"skmob.utils.gislib.getDistance",
"skmob.utils.gislib.getDistanceByHaversine",
"math.isclose",
"skmob.utils.gislib.getCoordinatesForDistance"
] | [((313, 359), 'skmob.utils.gislib.getDistance', 'gislib.getDistance', (['self.point_1', 'self.point_2'], {}), '(self.point_1, self.point_2)\n', (331, 359), False, 'from skmob.utils import gislib\n'), ((376, 410), 'math.isclose', 'math.isclose', (['output', '(36.293701213)'], {}), '(output, 36.293701213)\n', (388, 410),... |
# -*- coding: utf-8 -*-
import re
import json
def getTitle(storyContent):
pattern = re.compile("[^:\ ][A-Za-zäöüßÄÖÜ\d\ .\[\|\]\"\']*")
result = pattern.search(storyContent)
return result.group(0)
def getContent(storyContent):
pattern = re.compile("^[A-Za-z]{2}[A-Za-zäüößÄÖÜ\w\s\.\:]*", re.M... | [
"json.dumps",
"re.compile"
] | [((1258, 1309), 're.compile', 're.compile', (['"""::[\\\\ A-Za-zäöüß\\\\d\\\\s.\\\\[\\\\|\\\\]"\']*"""'], {}), '(\'::[\\\\ A-Za-zäöüß\\\\d\\\\s.\\\\[\\\\|\\\\]"\\\']*\')\n', (1268, 1309), False, 'import re\n'), ((1892, 1960), 'json.dumps', 'json.dumps', (['resultDict'], {'sort_keys': '(True)', 'indent': '(4)', 'ensure_... |
import unittest
import numpy as np
from gradient_checker import GradientChecker, create_op
from op_test_util import OpTestMeta
class MinusOpTest(unittest.TestCase):
__metaclass__ = OpTestMeta
def setUp(self):
self.type = "minus"
self.inputs = {
'X': np.random.random((32, 84)).asty... | [
"unittest.main",
"numpy.random.random",
"gradient_checker.create_op"
] | [((816, 831), 'unittest.main', 'unittest.main', ([], {}), '()\n', (829, 831), False, 'import unittest\n'), ((555, 573), 'gradient_checker.create_op', 'create_op', (['"""minus"""'], {}), "('minus')\n", (564, 573), False, 'from gradient_checker import GradientChecker, create_op\n'), ((289, 315), 'numpy.random.random', 'n... |
import logging
import os.path
import sys
from .modes import TrimmingMode
logger = logging.getLogger(__name__)
def process_args(args) -> dict:
"""
Process args from argparser and set defaults
"""
input_file = args.input
output_file = args.output or f"{input_file}.clipkit"
if not os.path.isfi... | [
"sys.exit",
"logging.getLogger"
] | [((84, 111), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (101, 111), False, 'import logging\n'), ((396, 406), 'sys.exit', 'sys.exit', ([], {}), '()\n', (404, 406), False, 'import sys\n'), ((525, 535), 'sys.exit', 'sys.exit', ([], {}), '()\n', (533, 535), False, 'import sys\n')] |
from django.contrib import admin
from django.urls import include, path
from django.conf.urls import url
from votes import urls
urlpatterns = [
path('admin/', admin.site.urls),
path('', include('comments.urls')),
path('api-auth/', include('rest_framework.urls')),
url(r'^', include(urls)),
]
| [
"django.urls.path",
"django.urls.include"
] | [((148, 179), 'django.urls.path', 'path', (['"""admin/"""', 'admin.site.urls'], {}), "('admin/', admin.site.urls)\n", (152, 179), False, 'from django.urls import include, path\n'), ((194, 218), 'django.urls.include', 'include', (['"""comments.urls"""'], {}), "('comments.urls')\n", (201, 218), False, 'from django.urls i... |
"""Seek behaviour in Pygame"""
import pygame
import numpy as np
import math
WIDTH,HEIGHT = 700,400
screen = pygame.display.set_mode((WIDTH,HEIGHT))
class Seeker():
def __init__(self,x,y):
super().__init__()
self.pos=np.array([x,y])
self.vel=np.array([0,0])
self.acc=n... | [
"numpy.multiply",
"pygame.draw.circle",
"numpy.subtract",
"math.sqrt",
"pygame.event.get",
"pygame.display.set_mode",
"pygame.init",
"pygame.mouse.get_pos",
"pygame.display.update",
"numpy.array",
"numpy.add"
] | [((117, 157), 'pygame.display.set_mode', 'pygame.display.set_mode', (['(WIDTH, HEIGHT)'], {}), '((WIDTH, HEIGHT))\n', (140, 157), False, 'import pygame\n'), ((1196, 1209), 'pygame.init', 'pygame.init', ([], {}), '()\n', (1207, 1209), False, 'import pygame\n'), ((1145, 1195), 'pygame.draw.circle', 'pygame.draw.circle', ... |
# Copyright 2016-2022 Swiss National Supercomputing Centre (CSCS/ETH Zurich)
# ReFrame Project Developers. See the top-level LICENSE file for details.
#
# SPDX-License-Identifier: BSD-3-Clause
import abc
import reframe.core.fields as fields
import reframe.utility.typecheck as typ
from reframe.core.exceptions import C... | [
"reframe.core.fields.DeprecatedField",
"reframe.core.fields.TypedField",
"reframe.core.exceptions.ContainerError"
] | [((1229, 1261), 'reframe.core.fields.TypedField', 'fields.TypedField', (['typ.List[str]'], {}), '(typ.List[str])\n', (1246, 1261), True, 'import reframe.core.fields as fields\n'), ((1484, 1701), 'reframe.core.fields.DeprecatedField', 'fields.DeprecatedField', (['_commands', '"""The `commands` field is deprecated, pleas... |
from django.urls import path, re_path, include
from . import views
app_name = 'osiris'
url_patterns_v2 = [
path('courses/all/', views.get_all_courses, name='getallcourses'),
]
urlpatterns = [
path('', views.index, name='index'),
path('api/unicodes/', views.unicodes, name='unicodes'),
path('api/<slug:... | [
"django.urls.re_path",
"django.urls.path",
"django.urls.include"
] | [((113, 178), 'django.urls.path', 'path', (['"""courses/all/"""', 'views.get_all_courses'], {'name': '"""getallcourses"""'}), "('courses/all/', views.get_all_courses, name='getallcourses')\n", (117, 178), False, 'from django.urls import path, re_path, include\n'), ((203, 238), 'django.urls.path', 'path', (['""""""', 'v... |
import numpy as np
import elevation.model_comparison
import os
import pandas
import multiprocessing
cur_dir = os.path.dirname(os.path.abspath(__file__))
class CFDModel(object):
def __init__(self, cfd_table=None, cfd_table_file=None):
if cfd_table is None:
#print "Loading CFD table from... | [
"os.path.abspath",
"multiprocessing.Pool"
] | [((126, 151), 'os.path.abspath', 'os.path.abspath', (['__file__'], {}), '(__file__)\n', (141, 151), False, 'import os\n'), ((756, 796), 'multiprocessing.Pool', 'multiprocessing.Pool', ([], {'processes': 'num_proc'}), '(processes=num_proc)\n', (776, 796), False, 'import multiprocessing\n')] |
import os
import collections
import pdb
import gym
import gym.envs.mujoco
import time
import csv
import json
import shutil
import numpy as np
import random
from . import ant_env
from . import proprioceptive_humanoid_env
from . import maze_ant
from . import maze_humanoid
# Wrapper that records everything we might care ... | [
"numpy.zeros",
"json.dumps",
"time.time",
"numpy.mean",
"collections.OrderedDict",
"shutil.copyfile",
"os.path.join",
"csv.DictWriter"
] | [((702, 713), 'time.time', 'time.time', ([], {}), '()\n', (711, 713), False, 'import time\n'), ((3162, 3187), 'collections.OrderedDict', 'collections.OrderedDict', ([], {}), '()\n', (3185, 3187), False, 'import collections\n'), ((5319, 5366), 'csv.DictWriter', 'csv.DictWriter', (['self.ep_f'], {'fieldnames': 'ep_fields... |
#!/usr/bin/env python3
import argparse
import json
import os
from pyquery import PyQuery
import re
import requests
# given a URL such as http://www.ustream.tv/recorded/102894434
# fetch the details of the presentation
def main():
parser = argparse.ArgumentParser()
parser.add_argument('-u', '--url', help='URL... | [
"os.mkdir",
"json.dump",
"pyquery.PyQuery",
"argparse.ArgumentParser",
"os.path.exists",
"requests.get",
"re.search"
] | [((245, 270), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (268, 270), False, 'import argparse\n'), ((686, 708), 'requests.get', 'requests.get', (['args.url'], {}), '(args.url)\n', (698, 708), False, 'import requests\n'), ((822, 850), 're.search', 're.search', (['"""\\\\d+$"""', 'args.url'], ... |
#!/usr/bin/env python
# coding=utf-8
import kaldiio
x=kaldiio.load_mat("/home/zlj/dxf/espnet/egs/vwm/tts1/decode/tts/xvectors/xvector.1.ark:4")
spemb = torch.FloatTensor(x).to(device)
print(str(x))
| [
"kaldiio.load_mat"
] | [((55, 149), 'kaldiio.load_mat', 'kaldiio.load_mat', (['"""/home/zlj/dxf/espnet/egs/vwm/tts1/decode/tts/xvectors/xvector.1.ark:4"""'], {}), "(\n '/home/zlj/dxf/espnet/egs/vwm/tts1/decode/tts/xvectors/xvector.1.ark:4')\n", (71, 149), False, 'import kaldiio\n')] |
import MapReduce
import sys
"""
Word Count Example in the Simple Python MapReduce Framework
"""
mr = MapReduce.MapReduce()
# =============================
# Do not modify above this line
def mapper(record):
# key: document identifier
# value: document contents
key = record[0]
friend = record[1]
... | [
"MapReduce.MapReduce"
] | [((103, 124), 'MapReduce.MapReduce', 'MapReduce.MapReduce', ([], {}), '()\n', (122, 124), False, 'import MapReduce\n')] |
import praw, os, discord, requests
from steamstorefront import SteamStoreFront
from datetime import datetime
from collections import deque
from bs4 import BeautifulSoup
from common import common, database
from ..helpers import steam, gamedeals, guild
from ..helpers.gamedeals import isFromAcceptableStore
class GameDea... | [
"common.common.getTimeFromTimestamp",
"common.common.getMasterLog",
"common.common.getConfig",
"steamstorefront.SteamStoreFront",
"common.database.Database",
"common.common.getDatetimeIST",
"common.common.getEnvironment",
"praw.Reddit",
"collections.deque"
] | [((439, 457), 'common.common.getConfig', 'common.getConfig', ([], {}), '()\n', (455, 457), False, 'from common import common, database\n'), ((486, 507), 'common.common.getMasterLog', 'common.getMasterLog', ([], {}), '()\n', (505, 507), False, 'from common import common, database\n'), ((525, 674), 'praw.Reddit', 'praw.R... |
import pprint
from googlevoice import Voice
def run():
voice = Voice()
voice.login()
pprint.pprint(voice.settings)
__name__ == '__main__' and run()
| [
"pprint.pprint",
"googlevoice.Voice"
] | [((70, 77), 'googlevoice.Voice', 'Voice', ([], {}), '()\n', (75, 77), False, 'from googlevoice import Voice\n'), ((101, 130), 'pprint.pprint', 'pprint.pprint', (['voice.settings'], {}), '(voice.settings)\n', (114, 130), False, 'import pprint\n')] |
#!/bin/env python3
from PIL import Image
from numpy import asarray
import json
regionmap = asarray(Image.open('RegionMap.png'))
region1 = 42 * 4
regions = [
None,
"Galactic Centre",
"Empyrean Straits",
"Ryker's Hope",
"Odin's Hold",
"Norma Arm",
"Arcadian Stream",
"Izanami",
"Inner... | [
"json.dumps",
"PIL.Image.open"
] | [((100, 127), 'PIL.Image.open', 'Image.open', (['"""RegionMap.png"""'], {}), "('RegionMap.png')\n", (110, 127), False, 'from PIL import Image\n'), ((2519, 2532), 'json.dumps', 'json.dumps', (['r'], {}), '(r)\n', (2529, 2532), False, 'import json\n'), ((1904, 1917), 'json.dumps', 'json.dumps', (['r'], {}), '(r)\n', (191... |
import click
import json
from pathlib import Path
from .query import query
CONTEXT_SETTINGS = dict(help_option_names=['-h', '--help'])
def _format_line(obj, _format):
if _format == 'refstr':
return obj.to_string()
if _format == 'str':
return '`{}` ({})'.format(obj.text,obj.version)
def _for... | [
"click.Choice",
"click.option",
"click.argument",
"click.command"
] | [((561, 609), 'click.command', 'click.command', ([], {'context_settings': 'CONTEXT_SETTINGS'}), '(context_settings=CONTEXT_SETTINGS)\n', (574, 609), False, 'import click\n'), ((611, 711), 'click.option', 'click.option', (['"""--version"""', '"""-v"""'], {'default': '"""ESV"""', 'help': '"""Bible version to query, defau... |
import os
import pygame
import random
from level_3.module import background_module
from level_3.module import foreground_module
from level_3.module import player_module
class Ghost():
"""
Describes ghost obstacles.
"""
# Loading ghost images
num_of_imgs = 6
list_of_lists = []
path = r'level_3/Utils/Pics/Ghost... | [
"random.randint",
"random.uniform",
"pygame.mask.from_surface",
"random.randrange",
"level_3.module.background_module.bg.get_width",
"os.listdir"
] | [((338, 354), 'os.listdir', 'os.listdir', (['path'], {}), '(path)\n', (348, 354), False, 'import os\n'), ((1971, 1994), 'random.randint', 'random.randint', (['(50)', '(400)'], {}), '(50, 400)\n', (1985, 1994), False, 'import random\n'), ((2062, 2100), 'random.randrange', 'random.randrange', (['Ghost.num_of_colours'], {... |
import json
from sklearn.metrics import mean_squared_error, mean_absolute_error
import numpy as np
from model import Dfembeding
from sklearn.kernel_ridge import KernelRidge
import torch
from PIL import Image
from utils import *
import csv
import torch.utils.data as data
import pandas as pd
def mean_absol... | [
"json.load",
"numpy.abs",
"csv.writer",
"torch.utils.data.DataLoader",
"numpy.std",
"sklearn.kernel_ridge.KernelRidge",
"pandas.read_csv",
"torch.load",
"model.Dfembeding",
"sklearn.metrics.mean_absolute_error",
"numpy.append",
"numpy.mean",
"numpy.array",
"torch.device"
] | [((5043, 5061), 'numpy.mean', 'np.mean', (['x'], {'axis': '(0)'}), '(x, axis=0)\n', (5050, 5061), True, 'import numpy as np\n'), ((5073, 5090), 'numpy.std', 'np.std', (['x'], {'axis': '(0)'}), '(x, axis=0)\n', (5079, 5090), True, 'import numpy as np\n'), ((5374, 5472), 'pandas.read_csv', 'pd.read_csv', (['"""/home/benk... |
import pickle
class Cache:
def __init__(self):
self._filename = "alliancepy.txt"
self._cache = {}
def __enter__(self):
try:
with open(self._filename, "rb") as file:
d = pickle.load(file)
for key, value in d.items():
self.... | [
"pickle.dump",
"pickle.load"
] | [((671, 691), 'pickle.dump', 'pickle.dump', (['d', 'file'], {}), '(d, file)\n', (682, 691), False, 'import pickle\n'), ((232, 249), 'pickle.load', 'pickle.load', (['file'], {}), '(file)\n', (243, 249), False, 'import pickle\n')] |
"""Test for examples.multiply.configs"""
import logging
import deepr as dpr
import deepr.examples.multiply
logging.basicConfig(level=logging.INFO)
PATH_CONFIG = dpr.io.Path(deepr.examples.multiply.__file__).parent / "configs"
def test_example_multiply_configs(tmpdir):
"""Test for examples.multiply.configs""... | [
"logging.basicConfig",
"deepr.io.Path",
"deepr.parse_config",
"deepr.io.read_json",
"deepr.from_config"
] | [((111, 150), 'logging.basicConfig', 'logging.basicConfig', ([], {'level': 'logging.INFO'}), '(level=logging.INFO)\n', (130, 150), False, 'import logging\n'), ((425, 470), 'deepr.io.read_json', 'dpr.io.read_json', (["(PATH_CONFIG / 'config.json')"], {}), "(PATH_CONFIG / 'config.json')\n", (441, 470), True, 'import deep... |
import numpy as np
from scipy import sparse
def fit_glove_bias(A, emb):
N = A.shape[0]
row_sum = np.array(A.sum(axis=1)).reshape(-1).astype(float)
col_sum = np.array(A.sum(axis=0)).reshape(-1).astype(float)
emb_sum = np.array(emb @ np.array(np.sum(emb, axis=0)).reshape((-1, 1))).reshape(-1)
row_s... | [
"numpy.multiply",
"numpy.sum",
"numpy.abs",
"numpy.power",
"numpy.zeros",
"numpy.sign",
"numpy.sqrt"
] | [((366, 377), 'numpy.zeros', 'np.zeros', (['N'], {}), '(N)\n', (374, 377), True, 'import numpy as np\n'), ((386, 397), 'numpy.zeros', 'np.zeros', (['N'], {}), '(N)\n', (394, 397), True, 'import numpy as np\n'), ((1272, 1292), 'numpy.zeros', 'np.zeros', (['grad.shape'], {}), '(grad.shape)\n', (1280, 1292), True, 'import... |
# Generated by Django 2.2.13 on 2020-10-04 06:53
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('socials', '0004_auto_20201004_0347'),
('shows', '0009_auto_20201004_0137'),
]
operations = [
migra... | [
"django.db.models.ForeignKey"
] | [((412, 552), 'django.db.models.ForeignKey', 'models.ForeignKey', ([], {'null': '(True)', 'on_delete': 'django.db.models.deletion.CASCADE', 'to': '"""socials.UserSocialNetwork"""', 'verbose_name': '"""Social Network"""'}), "(null=True, on_delete=django.db.models.deletion.CASCADE,\n to='socials.UserSocialNetwork', ve... |
import os
from pepper_snp.modules.python.ImageGenerationUI import UserInterfaceSupport
def make_images(bam_file, draft_file, region, output_path, total_threads, downsample_rate):
output_dir = UserInterfaceSupport.handle_output_directory(os.path.abspath(output_path))
chr_list, bed_list = UserInterfaceSupport.... | [
"pepper_snp.modules.python.ImageGenerationUI.UserInterfaceSupport.chromosome_level_parallelization",
"os.path.abspath",
"pepper_snp.modules.python.ImageGenerationUI.UserInterfaceSupport.get_chromosome_list"
] | [((299, 390), 'pepper_snp.modules.python.ImageGenerationUI.UserInterfaceSupport.get_chromosome_list', 'UserInterfaceSupport.get_chromosome_list', (['region', 'draft_file', 'bam_file'], {'region_bed': 'None'}), '(region, draft_file, bam_file,\n region_bed=None)\n', (339, 390), False, 'from pepper_snp.modules.python.I... |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.15 on 2020-02-26 07:38
from __future__ import unicode_literals
from datetime import datetime
from timezonefinder import TimezoneFinder
import pytz
from django.db import migrations
from django.utils import timezone
tf = TimezoneFinder()
def set_timezone(apps, schem... | [
"django.db.migrations.RunPython",
"django.utils.timezone.get_current_timezone",
"timezonefinder.TimezoneFinder",
"datetime.datetime",
"pytz.timezone"
] | [((273, 289), 'timezonefinder.TimezoneFinder', 'TimezoneFinder', ([], {}), '()\n', (287, 289), False, 'from timezonefinder import TimezoneFinder\n'), ((604, 626), 'pytz.timezone', 'pytz.timezone', (['tz_name'], {}), '(tz_name)\n', (617, 626), False, 'import pytz\n'), ((1088, 1122), 'django.db.migrations.RunPython', 'mi... |
import numpy as np
from scipy.linalg import cho_solve, inv
from scipy.stats import norm
from scipy.interpolate import InterpolatedUnivariateSpline
from sklearn.mixture import GaussianMixture as GMM
from .utils import custom_KDE
import time
class Acq(object):
'''
The base acq class.
'''
def ... | [
"numpy.sum",
"scipy.interpolate.InterpolatedUnivariateSpline",
"numpy.average",
"numpy.empty",
"sklearn.mixture.GaussianMixture",
"numpy.random.default_rng",
"numpy.append",
"numpy.loadtxt",
"numpy.sign",
"numpy.array_split",
"numpy.dot",
"numpy.concatenate",
"numpy.atleast_2d"
] | [((2119, 2143), 'numpy.append', 'np.append', (['pos', 'fidelity'], {}), '(pos, fidelity)\n', (2128, 2143), True, 'import numpy as np\n'), ((2464, 2480), 'numpy.atleast_2d', 'np.atleast_2d', (['x'], {}), '(x)\n', (2477, 2480), True, 'import numpy as np\n'), ((8341, 8354), 'numpy.sum', 'np.sum', (['w_raw'], {}), '(w_raw)... |
# -*- coding: utf-8 -*-
"""Concentrate the heavy business logic of the operations of an application.
It knows all Models that should be part of the flow and knows
the API/services of those models. It also orchestrate all the side-effects
and therefore can make the use of other use cases/services.
"""
from django.utils... | [
"posts_areas.models.PostArea.objects.find_by_name",
"tektank.libs_project.helpers.slug_generator",
"django.utils.translation.gettext",
"payments_comissions.models.PaymentComission.assign_payment_comission"
] | [((7769, 7796), 'tektank.libs_project.helpers.slug_generator', 'slug_generator', (['uuid', 'title'], {}), '(uuid, title)\n', (7783, 7796), False, 'from tektank.libs_project.helpers import slug_generator\n'), ((8119, 8175), 'payments_comissions.models.PaymentComission.assign_payment_comission', 'PaymentComission.assign_... |
#coding=utf-8
from flask.ext.wtf import Form
from wtforms import StringField, SubmitField, PasswordField
from wtforms.validators import Required, Email, Length, EqualTo
from app.models import User
class RegisterForm(Form):
username = StringField('用户名', validators=[Required('请输入用户名')])
email = StringField('邮箱'... | [
"wtforms.validators.Length",
"wtforms.validators.Email",
"wtforms.SubmitField",
"app.models.User.query.filter_by",
"wtforms.validators.Required",
"wtforms.validators.EqualTo"
] | [((657, 674), 'wtforms.SubmitField', 'SubmitField', (['"""注册"""'], {}), "('注册')\n", (668, 674), False, 'from wtforms import StringField, SubmitField, PasswordField\n'), ((1182, 1199), 'wtforms.SubmitField', 'SubmitField', (['"""登陆"""'], {}), "('登陆')\n", (1193, 1199), False, 'from wtforms import StringField, SubmitField... |
from functools import wraps
def cached(func):
cache = {}
@wraps(func)
def cached_wrapper(*args):
if args not in cache:
cache[args] = func(*args)
return cache[args]
return cached_wrapper
| [
"functools.wraps"
] | [((62, 73), 'functools.wraps', 'wraps', (['func'], {}), '(func)\n', (67, 73), False, 'from functools import wraps\n')] |
#!/usr/bin/env python
import socket
import threading
import config
import websocketclient
class WebSocketServer:
"""
Handle the Server, bind and accept new connections, open and close
clients connections.
"""
def __init__(self):
self.clients = []
def start(self):
"""
S... | [
"threading.Lock",
"websocketclient.WebSocketClient",
"socket.socket"
] | [((361, 376), 'socket.socket', 'socket.socket', ([], {}), '()\n', (374, 376), False, 'import socket\n'), ((1179, 1195), 'threading.Lock', 'threading.Lock', ([], {}), '()\n', (1193, 1195), False, 'import threading\n'), ((648, 697), 'websocketclient.WebSocketClient', 'websocketclient.WebSocketClient', (['conn', 'addr', '... |
import numpy as np
# class for 3D points in an image frame
class Point(object):
# class constructor
def __init__(self, img_map, location, color):
self.point = location
self.frames = []
self.idx = []
self.color = np.copy(color)
self.id = img_map.max_point
img_map... | [
"numpy.array",
"numpy.copy"
] | [((253, 267), 'numpy.copy', 'np.copy', (['color'], {}), '(color)\n', (260, 267), True, 'import numpy as np\n'), ((948, 1008), 'numpy.array', 'np.array', (['[self.point[0], self.point[1], self.point[2], 1.0]'], {}), '([self.point[0], self.point[1], self.point[2], 1.0])\n', (956, 1008), True, 'import numpy as np\n')] |
import copy
import json
from enum import Enum, IntFlag, Flag
from json import JSONEncoder
from typing import Any, List, Dict
from vgm.command import VgmCommand, VgmCommandType
class Waveform(Enum):
SAW = 0
SQUARE = 1
TRIANGLE = 2
NOISE = 3
def repr_json(self):
return self.name
class Op... | [
"copy.deepcopy",
"json.JSONEncoder.default"
] | [((5066, 5096), 'copy.deepcopy', 'copy.deepcopy', (['other.operators'], {}), '(other.operators)\n', (5079, 5096), False, 'import copy\n'), ((7940, 7973), 'json.JSONEncoder.default', 'json.JSONEncoder.default', (['self', 'o'], {}), '(self, o)\n', (7964, 7973), False, 'import json\n')] |
"""Tests out the code for generating randomised test trades/orders.
"""
from __future__ import print_function
__author__ = 'saeedamen' # <NAME> / <EMAIL>
#
# Copyright 2017 Cuemacro Ltd. - http//www.cuemacro.com / @cuemacro
#
# See the License for the specific language governing permissions and limitations under th... | [
"tcapy.util.loggermanager.LoggerManager",
"tcapy.data.datatestcreator.DataTestCreator",
"tcapy.conf.constants.Constants",
"tcapy.data.databasesource.DatabaseSourceCSVBinary",
"tcapy.data.databasesource.DatabaseSourceArctic",
"os.path.join"
] | [((696, 707), 'tcapy.conf.constants.Constants', 'Constants', ([], {}), '()\n', (705, 707), False, 'from tcapy.conf.constants import Constants\n'), ((1843, 1877), 'tcapy.data.datatestcreator.DataTestCreator', 'DataTestCreator', ([], {'write_to_db': '(False)'}), '(write_to_db=False)\n', (1858, 1877), False, 'from tcapy.d... |
from PySide2.QtCore import QCoreApplication
from PySide2.QtWidgets import QMenuBar, QMenu
def _quit():
QCoreApplication.quit()
class MenuBar(QMenuBar):
def __init__(self):
super().__init__()
file_action = self.addMenu(QMenu('File'))
file_action.menu().addAction('New Project')
... | [
"PySide2.QtCore.QCoreApplication.quit",
"PySide2.QtWidgets.QMenu"
] | [((109, 132), 'PySide2.QtCore.QCoreApplication.quit', 'QCoreApplication.quit', ([], {}), '()\n', (130, 132), False, 'from PySide2.QtCore import QCoreApplication\n'), ((247, 260), 'PySide2.QtWidgets.QMenu', 'QMenu', (['"""File"""'], {}), "('File')\n", (252, 260), False, 'from PySide2.QtWidgets import QMenuBar, QMenu\n')... |
# -*- coding:utf-8 -*-
import os
os.environ['TF_CPP_MIN_LOG_LEVEL'] = '2' # Remove unnecessary information
import numpy as np
# cpu_count = 4
# 因为服务器没有图形界面,所以必须这样弄
import matplotlib
matplotlib.use('Agg')
from matplotlib import pyplot as plt
# 好看的打印格式
def fancy_print(n = None, c = None, s... | [
"keras.preprocessing.image.ImageDataGenerator",
"numpy.load",
"matplotlib.pyplot.clf",
"matplotlib.pyplot.legend",
"tensorflow.config.experimental.set_memory_growth",
"matplotlib.pyplot.figure",
"matplotlib.use",
"keras.callbacks.EarlyStopping",
"tensorflow.config.experimental.list_physical_devices"... | [((205, 226), 'matplotlib.use', 'matplotlib.use', (['"""Agg"""'], {}), "('Agg')\n", (219, 226), False, 'import matplotlib\n'), ((1274, 1334), 'keras.preprocessing.image.ImageDataGenerator', 'ImageDataGenerator', ([], {'rescale': '(1.0 / 255)', 'validation_split': '(0.11)'}), '(rescale=1.0 / 255, validation_split=0.11)\... |
# -*- coding:utf-8 -*-
from __future__ import unicode_literals
from django.core.management.base import BaseCommand, CommandError
from yepes.contrib.slugs import SlugHistory
class Command(BaseCommand):
help = 'Populates the slug history.'
requires_system_checks = True
def add_arguments(self, parser):
... | [
"yepes.contrib.slugs.SlugHistory.objects.populate"
] | [((1246, 1338), 'yepes.contrib.slugs.SlugHistory.objects.populate', 'SlugHistory.objects.populate', ([], {'force': 'force', 'app_label': 'app_label', 'model_names': 'model_names'}), '(force=force, app_label=app_label, model_names=\n model_names)\n', (1274, 1338), False, 'from yepes.contrib.slugs import SlugHistory\n... |
#!/usr/bin/python3
# -*- coding: utf-8 -*-
# --------------------------------------------------------------------------------
# Librerías
from bs4 import BeautifulSoup
import requests
import time
import json
import os
from json import dumps
import anyjson
from datastore import SubSecction
from log_helper import LogHel... | [
"time.sleep",
"requests.get",
"datastore.SubSecction",
"bs4.BeautifulSoup",
"nltk.download",
"log_helper.LogHelper",
"parsedata.Tokenizer"
] | [((512, 534), 'nltk.download', 'nltk.download', (['"""punkt"""'], {}), "('punkt')\n", (525, 534), False, 'import nltk\n'), ((654, 665), 'log_helper.LogHelper', 'LogHelper', ([], {}), '()\n', (663, 665), False, 'from log_helper import LogHelper\n'), ((1980, 2020), 'requests.get', 'requests.get', (['url'], {'timeout': 'C... |
# Version 1
#TODO clean up these imports now that we are doing more modular processing
import sys, signal,platform,os,time,subprocess,configparser,multiprocessing,easygui,requests
from Communicate import *
from functions import LinuxIdleTime,WindowsIdleTime
#Script Version
ScriptVersion = '1.0'
#SHA256 of your downtim... | [
"sys.platform.startswith",
"os.mkdir",
"functions.DownloadData",
"sheepit.LinuxRender64",
"win32gui.ShowWindow",
"Miner.LinuxMine64",
"os.path.exists",
"win32gui.GetWindowText",
"functions.LinuxIdleTime",
"win32gui.EnumWindows",
"easygui.ynbox",
"shutil.copyfile",
"win32gui.GetClassName",
... | [((11897, 11924), 'configparser.ConfigParser', 'configparser.ConfigParser', ([], {}), '()\n', (11922, 11924), False, 'import sys, signal, platform, os, time, subprocess, configparser, multiprocessing, easygui, requests\n'), ((13451, 13483), 'sys.platform.startswith', 'sys.platform.startswith', (['"""win32"""'], {}), "(... |
import pygame
import sys
#define bird class
class Bird(object):
def __init__(self):
self.birdRect = pygame.Rect(65,50,50,50)
self.birdStatus = [pygame.image.load("flappybirdassets/assets/1.png"),
pygame.image.load("flappybirdassets/assets/2.png"),
... | [
"pygame.quit",
"pygame.font.SysFont",
"pygame.event.get",
"pygame.display.set_mode",
"pygame.Rect",
"pygame.init",
"pygame.display.update",
"pygame.image.load",
"pygame.time.Clock",
"sys.exit"
] | [((3678, 3691), 'pygame.quit', 'pygame.quit', ([], {}), '()\n', (3689, 3691), False, 'import pygame\n'), ((1382, 1405), 'pygame.display.update', 'pygame.display.update', ([], {}), '()\n', (1403, 1405), False, 'import pygame\n'), ((2417, 2449), 'pygame.font.SysFont', 'pygame.font.SysFont', (['"""Arial"""', '(70)'], {}),... |
from mock import patch
from specter import Spec, expect
from requests_cloud_auth import rackspace
from spec import get_keystone_v2_auth_resp
class AuthenticationToRackspace(Spec):
class PasswordAuthentication(Spec):
def before_all(self):
self.auth = rackspace.RackspacePasswordAuth(
... | [
"requests_cloud_auth.rackspace.RackspacePasswordAuth",
"spec.get_keystone_v2_auth_resp",
"specter.expect",
"mock.patch",
"requests_cloud_auth.rackspace.RackspaceApiKeyAuth"
] | [((405, 427), 'mock.patch', 'patch', (['"""requests.post"""'], {}), "('requests.post')\n", (410, 427), False, 'from mock import patch\n'), ((739, 761), 'mock.patch', 'patch', (['"""requests.post"""'], {}), "('requests.post')\n", (744, 761), False, 'from mock import patch\n'), ((1188, 1210), 'mock.patch', 'patch', (['""... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# @Time : 17/3/21 下午5:32
import os
from app import create_app, db
from flask_script import Manager
from flask_migrate import Migrate, MigrateCommand
app = create_app(os.getenv('FLASK_CONFIG') or 'default')
manager = Manager(app)
migrate = Migrate(app, db)
manager.add_... | [
"flask_script.Manager",
"flask_migrate.Migrate",
"os.getenv"
] | [((267, 279), 'flask_script.Manager', 'Manager', (['app'], {}), '(app)\n', (274, 279), False, 'from flask_script import Manager\n'), ((290, 306), 'flask_migrate.Migrate', 'Migrate', (['app', 'db'], {}), '(app, db)\n', (297, 306), False, 'from flask_migrate import Migrate, MigrateCommand\n'), ((217, 242), 'os.getenv', '... |