code stringlengths 22 1.05M | apis listlengths 1 3.31k | extract_api stringlengths 75 3.25M |
|---|---|---|
"""
Kravatte Achouffe Cipher Suite: Encryption, Decryption, and Authentication Tools based on the Farfalle modes
Copyright 2018 <NAME>
see LICENSE file
"""
from multiprocessing import Pool
from math import floor, ceil, log2
from typing import Tuple
from os import cpu_count
from ctypes import memset
import numpy as np
... | [
"numpy.copy",
"math.ceil",
"hashlib.md5",
"numpy.bitwise_xor.reduce",
"math.floor",
"math.log2",
"time.perf_counter",
"numpy.array",
"numpy.zeros",
"numpy.uint64",
"multiprocessing.Pool",
"os.cpu_count",
"numpy.frombuffer",
"ctypes.memset"
] | [((870, 1005), 'numpy.array', 'np.array', (['[32778, 9223372039002259466, 9223372039002292353, 9223372036854808704, \n 2147483649, 9223372039002292232]'], {'dtype': 'np.uint64'}), '([32778, 9223372039002259466, 9223372039002292353, \n 9223372036854808704, 2147483649, 9223372039002292232], dtype=np.uint64)\n', (87... |
from ics import Calendar, Event
from datetime import date, timedelta
from db import fetchall_dict
from rich import print
from flag import flag
c = Calendar()
def add_allday_event(c, event_start, event_name, event_description):
e = Event()
e.name = event_name
e.description = event_description
e.begin... | [
"db.fetchall_dict",
"flag.flag",
"ics.Event",
"datetime.timedelta",
"ics.Calendar",
"rich.print",
"datetime.date.today"
] | [((149, 159), 'ics.Calendar', 'Calendar', ([], {}), '()\n', (157, 159), False, 'from ics import Calendar, Event\n'), ((457, 747), 'db.fetchall_dict', 'fetchall_dict', (['"""\nselect\n u\n , c.n\n , concat_ws(\', \', c.s,c.c) s\n , v.video\nfrom cities c\nJOIN videos v ON v.id = c.id\norder by (rank < 3500 a... |
import logging
import requests
from settings_csv import ALGO_NFDOMAINS
# API documentation: https://editor.swagger.io/?url=https://api.testnet.nf.domains/info/openapi3.yaml
class NFDomainsAPI:
session = requests.Session()
def get_address(self, name):
endpoint = f"nfd/{name}"
para... | [
"logging.info",
"requests.Session"
] | [((218, 236), 'requests.Session', 'requests.Session', ([], {}), '()\n', (234, 236), False, 'import requests\n'), ((883, 942), 'logging.info', 'logging.info', (['"""Querying NFDomains endpoint %s..."""', 'endpoint'], {}), "('Querying NFDomains endpoint %s...', endpoint)\n", (895, 942), False, 'import logging\n')] |
# -*- coding: utf-8
from django.contrib import admin
from ancfindersite.models import *
@admin.register(CommissionerInfo)
class CommissionerInfoAdmin(admin.ModelAdmin):
list_display = ['id', 'latest', 'created', 'author', 'anc', 'smd', 'field_name', 'field_value', 'linkage']
raw_id_fields = ['author']
re... | [
"django.contrib.admin.register",
"django.contrib.admin.site.register"
] | [((92, 124), 'django.contrib.admin.register', 'admin.register', (['CommissionerInfo'], {}), '(CommissionerInfo)\n', (106, 124), False, 'from django.contrib import admin\n'), ((810, 839), 'django.contrib.admin.site.register', 'admin.site.register', (['Document'], {}), '(Document)\n', (829, 839), False, 'from django.cont... |
# Author: <NAME>
# Date: January 29, 2017
import tornado.ioloop
import tornado.web
import tornado.httpserver
import hashlib
import base64
import json
import mysql.connector as sql
dbuser = 'csse'
# Register a new user
class UserHandler(tornado.web.RequestHandler):
def set_default_headers(self):
self.set_header... | [
"mysql.connector.connect",
"base64.b64encode"
] | [((621, 685), 'mysql.connector.connect', 'sql.connect', ([], {'user': 'dbuser', 'database': '"""wireshark"""', 'host': '"""127.0.0.1"""'}), "(user=dbuser, database='wireshark', host='127.0.0.1')\n", (632, 685), True, 'import mysql.connector as sql\n'), ((1802, 1866), 'mysql.connector.connect', 'sql.connect', ([], {'use... |
from typing import List, Tuple
from objects.TypedDicts import TypedPresence, TypedReadMatch
from objects.constants.GameModes import GameModes
from objects.constants.Modificators import Mods
from objects.constants.Slots import SlotStatus, SlotTeams
from objects.constants.multiplayer import MatchTypes, MatchScoringTypes... | [
"packets.Reader.index.KurisoBuffer",
"objects.Multiplayer.Slot"
] | [((605, 623), 'packets.Reader.index.KurisoBuffer', 'KurisoBuffer', (['None'], {}), '(None)\n', (617, 623), False, 'from packets.Reader.index import KurisoBuffer\n'), ((1103, 1121), 'packets.Reader.index.KurisoBuffer', 'KurisoBuffer', (['None'], {}), '(None)\n', (1115, 1121), False, 'from packets.Reader.index import Kur... |
# coding: utf-8
import re
def preg_replace_callback(pattern, callback, subject):
return re.sub(pattern, callback, subject)
if __name__ == '__main__':
text = 'April fools day is 04/01/2002\n' + \
'Last christmas was 12/24/2001\n'
print(preg_replace_callback(r'(\d{2}/\d{2}/)(\d{4})', lambda m... | [
"re.sub"
] | [((95, 129), 're.sub', 're.sub', (['pattern', 'callback', 'subject'], {}), '(pattern, callback, subject)\n', (101, 129), False, 'import re\n')] |
"""Example of a Web Scraper using Regular Expressions"""
# Dependencies
import re
# Data
text_1 = "crypto-bot that is trading Bitcoin and other currencies"
text_2 = "cryptographic encryption methods that can be cracked easily with quantum computers"
# One-Liner
pattern = re.compile("crypto(.{1,30})coin")
# Result
p... | [
"re.compile"
] | [((275, 308), 're.compile', 're.compile', (['"""crypto(.{1,30})coin"""'], {}), "('crypto(.{1,30})coin')\n", (285, 308), False, 'import re\n')] |
from django.contrib.auth.decorators import login_required
from django.shortcuts import render, get_object_or_404, redirect
from django.http import HttpResponse, JsonResponse
from selenium import webdriver
from webdriver_manager.chrome import ChromeDriverManager
from selenium.webdriver.support.ui import WebDriverWait
f... | [
"os.path.exists",
"selenium.webdriver.ChromeOptions",
"app.models.ItalianName.objects.all",
"app.models.ItalianName",
"django.http.JsonResponse",
"app.models.City",
"csv.writer",
"selenium.webdriver.common.action_chains.ActionChains",
"django.contrib.auth.decorators.login_required",
"webdriver_man... | [((617, 652), 'django.contrib.auth.decorators.login_required', 'login_required', ([], {'login_url': '"""/login/"""'}), "(login_url='/login/')\n", (631, 652), False, 'from django.contrib.auth.decorators import login_required\n'), ((7585, 7620), 'django.contrib.auth.decorators.login_required', 'login_required', ([], {'lo... |
from pyntcloud import PyntCloud
import pyembree
import numpy as np
import trimesh
from trimesh import sample, ray, triangles
from trimesh.ray.ray_pyembree import RayMeshIntersector
import pandas as pd
cloud = PyntCloud.from_file("/home/mjia/Documents/ShapeCompletion/test.ply")
sample = cloud.get_sample(name='mesh_ran... | [
"trimesh.load",
"trimesh.sample.plot",
"pyntcloud.PyntCloud.from_file"
] | [((211, 279), 'pyntcloud.PyntCloud.from_file', 'PyntCloud.from_file', (['"""/home/mjia/Documents/ShapeCompletion/test.ply"""'], {}), "('/home/mjia/Documents/ShapeCompletion/test.ply')\n", (230, 279), False, 'from pyntcloud import PyntCloud\n'), ((362, 384), 'trimesh.sample.plot', 'sample.plot', ([], {'mesh': '(True)'})... |
"""
# License
Each contributor holds copyright over their contributions to Caffe-Tensorflow. In particular:
- Any included network model is provided under its original license.
- Any portion derived from Caffe is provided under its original license.
- Caffe-tensorflow is provided under the MIT license, as specified... | [
"sys.stderr.write"
] | [((2809, 2830), 'sys.stderr.write', 'sys.stderr.write', (['msg'], {}), '(msg)\n', (2825, 2830), False, 'import sys\n')] |
import numpy as np
import gym
poleThetaSpace = np.linspace(-0.209, 0.209, 10)
poleThetaVelSpace = np.linspace(-4, 4, 10)
cartPosSpace = np.linspace(-2.4, 2.4, 10)
cartVelSpace = np.linspace(-4, 4, 10)
def get_state(observation):
cartX, cartXdot, cartTheta, cartThetaDot = observation
cartX = int(np.digitize(ca... | [
"numpy.mean",
"numpy.digitize",
"numpy.random.random",
"numpy.argmax",
"numpy.sum",
"numpy.linspace",
"numpy.zeros",
"gym.make"
] | [((48, 78), 'numpy.linspace', 'np.linspace', (['(-0.209)', '(0.209)', '(10)'], {}), '(-0.209, 0.209, 10)\n', (59, 78), True, 'import numpy as np\n'), ((99, 121), 'numpy.linspace', 'np.linspace', (['(-4)', '(4)', '(10)'], {}), '(-4, 4, 10)\n', (110, 121), True, 'import numpy as np\n'), ((137, 163), 'numpy.linspace', 'np... |
import urllib.request, urllib.parse, urllib.error
import xml.etree.ElementTree as ET
url= input('Enter - ')
data= urllib.request.urlopen(url).read().decode()
#print(type('data'))
#data ='''<commentinfo>tag</commentinfo>'''
#print("~~~",data)
c=0
commentsinfo = ET.fromstring(data)#starting tag. ie is "commentinfo" in ... | [
"xml.etree.ElementTree.fromstring"
] | [((263, 282), 'xml.etree.ElementTree.fromstring', 'ET.fromstring', (['data'], {}), '(data)\n', (276, 282), True, 'import xml.etree.ElementTree as ET\n')] |
"""
spaceshooter.py
Author: emBrileg08
Credit: Spacewar Source Code
www.pythoncentral.io for information on random number generation
Assignment:
Write and submit a program that implements the spacewar game:
https://github.com/HHS-IntroProgramming/Spacewar
"""
from ggame import App, Sprite, ImageAsset, Frame
import ran... | [
"ggame.ImageAsset",
"math.cos",
"math.sin",
"random.randint",
"ggame.Frame"
] | [((1939, 1973), 'ggame.ImageAsset', 'ImageAsset', (['"""images/starfield.jpg"""'], {}), "('images/starfield.jpg')\n", (1949, 1973), False, 'from ggame import App, Sprite, ImageAsset, Frame\n'), ((2111, 2139), 'ggame.ImageAsset', 'ImageAsset', (['"""images/sun.png"""'], {}), "('images/sun.png')\n", (2121, 2139), False, ... |
import normalize_sentences
import spacy
nlp = spacy.load('de_core_news_sm')
test_sentence = 'Der schlaue Fuchs sagte "Treffen um 16:20 Uhr!" aber war schon 20 Minuten früher da. Im Jahre 1995 schuf er das Gedicht.'
def test_sent(test_sentence):
result = normalize_sentences.normalize(nlp, test_sentence)
prin... | [
"spacy.load",
"normalize_sentences.normalize"
] | [((47, 76), 'spacy.load', 'spacy.load', (['"""de_core_news_sm"""'], {}), "('de_core_news_sm')\n", (57, 76), False, 'import spacy\n'), ((261, 310), 'normalize_sentences.normalize', 'normalize_sentences.normalize', (['nlp', 'test_sentence'], {}), '(nlp, test_sentence)\n', (290, 310), False, 'import normalize_sentences\n'... |
from app import app
import unittest
import base64
import json
class TestLogin(unittest.TestCase):
def setUp(self):
app.config['TESTING'] = True
self.app = app.test_client()
self.user_name = "<EMAIL>"
self.password = "<PASSWORD>"
self.valid_credentials = base64.b64encode(b'<... | [
"base64.b64encode",
"json.dumps",
"app.app.test_client"
] | [((177, 194), 'app.app.test_client', 'app.test_client', ([], {}), '()\n', (192, 194), False, 'from app import app\n'), ((607, 1145), 'json.dumps', 'json.dumps', (["{'cook_time_in_min': 15, 'prep_time_in_min': 15, 'title':\n 'Creamy Cajun Chicken Pasta', 'cuisine': 'Italian', 'servings': 2,\n 'ingredients': ['4 ou... |
from __future__ import division
import copy
from functools import reduce
import numpy
import six
from mpilot import params
from mpilot.commands import Command
from mpilot.libraries.eems.exceptions import (
MismatchedWeights,
MixedArrayLengths,
DuplicateRawValues,
)
from mpilot.libraries.eems.mixins impor... | [
"numpy.copy",
"mpilot.params.ResultParameter",
"numpy.ma.std",
"numpy.ma.mean",
"mpilot.utils.insure_fuzzy",
"numpy.full",
"mpilot.params.PathParameter",
"mpilot.params.NumberParameter",
"numpy.ma.minimum",
"numpy.ma.maximum",
"numpy.logical_and",
"mpilot.params.DataParameter",
"numpy.ma.emp... | [((565, 587), 'mpilot.params.DataParameter', 'params.DataParameter', ([], {}), '()\n', (585, 587), False, 'from mpilot import params\n'), ((970, 992), 'mpilot.params.DataParameter', 'params.DataParameter', ([], {}), '()\n', (990, 992), False, 'from mpilot import params\n'), ((1439, 1461), 'mpilot.params.DataParameter',... |
# Generated by Django 3.0.5 on 2020-06-10 06:18
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('api', '0021_auto_20200606_0449'),
]
operations = [
migrations.AlterField(
model_name='endereco',
name='bairro',
... | [
"django.db.models.CharField"
] | [((334, 389), 'django.db.models.CharField', 'models.CharField', ([], {'blank': '(True)', 'max_length': '(100)', 'null': '(True)'}), '(blank=True, max_length=100, null=True)\n', (350, 389), False, 'from django.db import migrations, models\n'), ((518, 573), 'django.db.models.CharField', 'models.CharField', ([], {'blank':... |
from flask import render_template, redirect, url_for, flash, request
from werkzeug.urls import url_parse
from flask_login import login_user, logout_user, current_user
from flask_wtf import FlaskForm
from wtforms import StringField, PasswordField, BooleanField, SubmitField, TextAreaField
from wtforms.validators import V... | [
"flask.render_template",
"flask_babel._",
"werkzeug.datastructures.MultiDict",
"flask.flash",
"wtforms.validators.Email",
"flask.url_for",
"flask_babel.lazy_gettext",
"flask.Blueprint",
"wtforms.validators.DataRequired"
] | [((563, 594), 'flask.Blueprint', 'Blueprint', (['"""messages"""', '__name__'], {}), "('messages', __name__)\n", (572, 594), False, 'from flask import Blueprint\n'), ((615, 652), 'flask.Blueprint', 'Blueprint', (['"""messages_email"""', '__name__'], {}), "('messages_email', __name__)\n", (624, 652), False, 'from flask i... |
"""Useful constants.
"""
from rasterio.crs import CRS
WGS84_SRID = 4326
#: WGS84 CRS.
WGS84_CRS = CRS.from_epsg(WGS84_SRID)
WEB_MERCATOR_SRID = 3857
#: Web Mercator CRS.
WEB_MERCATOR_CRS = CRS.from_epsg(WEB_MERCATOR_SRID)
# Best widely used, equal area projection according to
# http://icaci.org/documents/ICC_procee... | [
"rasterio.crs.CRS",
"rasterio.crs.CRS.from_epsg"
] | [((100, 125), 'rasterio.crs.CRS.from_epsg', 'CRS.from_epsg', (['WGS84_SRID'], {}), '(WGS84_SRID)\n', (113, 125), False, 'from rasterio.crs import CRS\n'), ((192, 224), 'rasterio.crs.CRS.from_epsg', 'CRS.from_epsg', (['WEB_MERCATOR_SRID'], {}), '(WEB_MERCATOR_SRID)\n', (205, 224), False, 'from rasterio.crs import CRS\n'... |
import configparser
""" VARIABLES """
config_Path = "EngineDataFile\EngineConfig\GEngineSettings.ini"
class GEngineConfig:
def __init__(self):
try:
with open(config_Path):
print("File exists")
except IOError:
print("Error opening " + str(config_Path) + ", cr... | [
"configparser.ConfigParser"
] | [((927, 954), 'configparser.ConfigParser', 'configparser.ConfigParser', ([], {}), '()\n', (952, 954), False, 'import configparser\n'), ((358, 385), 'configparser.ConfigParser', 'configparser.ConfigParser', ([], {}), '()\n', (383, 385), False, 'import configparser\n')] |
#!/usr/bin/env python3
from cProfile import Profile
from numpy import linspace
from super_material.gap_energy import BCSGapEnergy
def run():
bcs_gap_energy = BCSGapEnergy(1.5e-3, 4000)
temperatures = linspace(0, bcs_gap_energy.critical_temperature(), 500)
with Profile() as profile:
for tempera... | [
"cProfile.Profile",
"super_material.gap_energy.BCSGapEnergy"
] | [((167, 193), 'super_material.gap_energy.BCSGapEnergy', 'BCSGapEnergy', (['(0.0015)', '(4000)'], {}), '(0.0015, 4000)\n', (179, 193), False, 'from super_material.gap_energy import BCSGapEnergy\n'), ((279, 288), 'cProfile.Profile', 'Profile', ([], {}), '()\n', (286, 288), False, 'from cProfile import Profile\n')] |
# -*- coding: utf-8 -*-
from django.contrib import admin
from django.contrib.auth.admin import UserAdmin
from appProcafe.models import Department, Unit, Section, Risk, Position, Location,\
Paysheet, Type, CourseRequest, CourseChangeRequest
from appProcafe.models import Telephone, Document, Takes, Course
from ... | [
"django.utils.translation.ugettext_lazy",
"django.contrib.admin.site.register",
"appProcafe.models.UserProfile.objects.get",
"django.contrib.admin.site.unregister",
"django.contrib.auth.admin.UserAdmin.change_view"
] | [((457, 488), 'django.contrib.admin.site.register', 'admin.site.register', (['Department'], {}), '(Department)\n', (476, 488), False, 'from django.contrib import admin\n'), ((490, 515), 'django.contrib.admin.site.register', 'admin.site.register', (['Unit'], {}), '(Unit)\n', (509, 515), False, 'from django.contrib impor... |
#!/usr/bin/env python3
from flask import Flask, render_template, request
import os,random,socket
app = Flask(__name__)
images = [
"las-01.jpg",
"las-02.jpg",
"las-03.jpg",
"las-04.jpg",
"las-05.jpg",
"las-06.jpg"
]
@app.route('/')
def index():
host_name = "{} to {}".format(socket.gethost... | [
"flask.render_template",
"random.choice",
"flask.Flask",
"os.environ.get",
"socket.gethostname"
] | [((105, 120), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (110, 120), False, 'from flask import Flask, render_template, request\n'), ((421, 494), 'flask.render_template', 'render_template', (['"""index.html"""'], {'image_path': 'image_path', 'host_name': 'host_name'}), "('index.html', image_path=image_p... |
from os import listdir
from os.path import isfile, join
import numpy as np
import matplotlib.pyplot as plt
from magenta.models.nsynth.wavenet import fastgen
import sys
# Change path back to /src to load other modules
sys.path.insert(0, '/home/ubuntu/DeepBass/src')
from ingestion.IO_utils import Load, Save
from preproce... | [
"magenta.models.nsynth.wavenet.fastgen.encode",
"sys.path.insert",
"streamlit.pyplot",
"os.listdir",
"os.path.join",
"preprocess.SilenceRemoval.SR",
"numpy.linspace",
"ingestion.IO_utils.Load",
"magenta.models.nsynth.wavenet.fastgen.synthesize",
"ingestion.IO_utils.Save",
"time.time",
"matplot... | [((217, 264), 'sys.path.insert', 'sys.path.insert', (['(0)', '"""/home/ubuntu/DeepBass/src"""'], {}), "(0, '/home/ubuntu/DeepBass/src')\n", (232, 264), False, 'import sys\n'), ((2443, 2482), 'ingestion.IO_utils.Load', 'Load', (['AUDIO_DIR', 'FirstSong_fname'], {'sr': 'sr'}), '(AUDIO_DIR, FirstSong_fname, sr=sr)\n', (24... |
import os
from sqlalchemy import create_engine
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.orm import sessionmaker
USER = os.getenv("DB_USER")
PASS = os.getenv("DB_PASSWORD")
HOST = os.getenv("DB_HOST")
PORT = os.getenv("DB_PORT")
SCHEMA = os.getenv("DB_SCHEMA")
SQLALCHEMY_DATABASE_URL = ... | [
"sqlalchemy.orm.sessionmaker",
"sqlalchemy.ext.declarative.declarative_base",
"sqlalchemy.create_engine",
"os.getenv"
] | [((152, 172), 'os.getenv', 'os.getenv', (['"""DB_USER"""'], {}), "('DB_USER')\n", (161, 172), False, 'import os\n'), ((180, 204), 'os.getenv', 'os.getenv', (['"""DB_PASSWORD"""'], {}), "('DB_PASSWORD')\n", (189, 204), False, 'import os\n'), ((212, 232), 'os.getenv', 'os.getenv', (['"""DB_HOST"""'], {}), "('DB_HOST')\n"... |
#!/usr/bin/env python
import sys
sys.path.append("..")
import json
import click
import datetime
import os
import shutil
from zipfile import ZipFile
from tempfile import mkdtemp
from scale_mesh import scale_mesh
from wearebeautiful.bundles import validate_manifest, MAX_SCREENSHOT_SIZE
from wearebeautiful import model_... | [
"os.path.exists",
"click.argument",
"wearebeautiful.bundles.validate_manifest",
"os.path.getsize",
"sys.exit",
"zipfile.ZipFile",
"json.loads",
"click.option",
"os.path.join",
"tempfile.mkdtemp",
"scale_mesh.scale_mesh",
"shutil.rmtree",
"shutil.copy",
"click.command",
"sys.path.append"
... | [((34, 55), 'sys.path.append', 'sys.path.append', (['""".."""'], {}), "('..')\n", (49, 55), False, 'import sys\n'), ((338, 353), 'click.command', 'click.command', ([], {}), '()\n', (351, 353), False, 'import click\n'), ((355, 452), 'click.option', 'click.option', (['"""--invert/--no-invert"""'], {'default': '(False)', ... |
"""
Adapted from https://github.com/hovinh/DeCNN
"""
import numpy as np
from keras import backend as K
class Backpropagation():
def __init__(self, model, layer_name, input_data, layer_idx=None, masking=None):
"""
@params:
- model: a Keras Model.
- layer_name: name of layer... | [
"numpy.abs",
"numpy.mean",
"keras.backend.cast",
"numpy.ones",
"numpy.random.random",
"keras.backend.mean",
"keras.backend.gradients",
"numpy.zeros",
"keras.backend.function",
"numpy.amax"
] | [((1485, 1525), 'keras.backend.mean', 'K.mean', (['(self.layer.output * self.masking)'], {}), '(self.layer.output * self.masking)\n', (1491, 1525), True, 'from keras import backend as K\n'), ((1600, 1643), 'keras.backend.function', 'K.function', (['[self.model.input]', '[gradients]'], {}), '([self.model.input], [gradie... |
import torch
import numpy as np
from rlbot.agents.base_agent import SimpleControllerState, BaseAgent
class OutputFormatter():
"""
A class to format model output
"""
def transform_action(self, action):
"""
Transforms the action into a controller state.
"""
action = acti... | [
"rlbot.agents.base_agent.BaseAgent.convert_output_to_v4",
"numpy.concatenate"
] | [((428, 481), 'numpy.concatenate', 'np.concatenate', (['(action[:5], action[5:] >= 0)'], {'axis': '(0)'}), '((action[:5], action[5:] >= 0), axis=0)\n', (442, 481), True, 'import numpy as np\n'), ((512, 556), 'rlbot.agents.base_agent.BaseAgent.convert_output_to_v4', 'BaseAgent.convert_output_to_v4', (['self', 'action'],... |
import discord
from discord.ext import commands
import re
from .errors import BadGameArgument
from dateutil.relativedelta import relativedelta
import datetime
import parsedatetime as pdt
import typing
import operator
__all__ = (
'CommandConverter',
'dice_roll',
'board_coords',
'espeak... | [
"dateutil.relativedelta.relativedelta",
"re.compile",
"discord.ext.commands.CommandNotFound",
"datetime.datetime.utcnow",
"re.match",
"parsedatetime.Calendar",
"discord.ext.commands.BadArgument"
] | [((745, 802), 're.match', 're.match', (['"""(?P<count>\\\\d+)?(d(?P<sides>\\\\d+))?"""', 'argument'], {}), "('(?P<count>\\\\d+)?(d(?P<sides>\\\\d+))?', argument)\n", (753, 802), False, 'import re\n'), ((2159, 2801), 're.compile', 're.compile', (['"""(?:(?P<years>[0-9])(?:years?|y))? # e.g. 2y\n ... |
# coding: utf-8
from __future__ import absolute_import, print_function, unicode_literals
from datetime import datetime
import time
from fabric.api import cd, sudo, run as fabrun, env, settings, abort, hide
env.use_ssh_config = True
env.ssh_config_path = "ssh.config"
CONTAINER_PORT = {
"blue": "4567",
"green... | [
"fabric.api.cd",
"time.sleep",
"fabric.api.sudo",
"datetime.datetime.now",
"fabric.api.settings",
"fabric.api.hide",
"fabric.api.abort"
] | [((639, 688), 'fabric.api.sudo', 'sudo', (['"""ls /etc/nginx/switch/blue"""'], {'warn_only': '(True)'}), "('ls /etc/nginx/switch/blue', warn_only=True)\n", (643, 688), False, 'from fabric.api import cd, sudo, run as fabrun, env, settings, abort, hide\n'), ((850, 900), 'fabric.api.sudo', 'sudo', (['"""docker ps | grep s... |
# Copyright (c) LinkedIn Corporation. All rights reserved. Licensed under the BSD-2 Clause license.
# See LICENSE in the project root for license information.
import requests
import time
from testutils import prefix,api_v0
start, end = int(time.time()), int(time.time() + 36000)
start = start / 1000 * 1000
end = end /... | [
"time.time",
"testutils.prefix",
"testutils.api_v0"
] | [((766, 798), 'testutils.prefix', 'prefix', (['"""test_v0_override_split"""'], {}), "('test_v0_override_split')\n", (772, 798), False, 'from testutils import prefix, api_v0\n'), ((1863, 1900), 'testutils.prefix', 'prefix', (['"""test_v0_override_edit_start"""'], {}), "('test_v0_override_edit_start')\n", (1869, 1900), F... |
import json
from genie import uid, with_clip
class MinifyJsonCommand:
def metadata(self, parameters):
arg = "minify-json"
return dict(
uid=uid(1),
arg=arg,
title="Minify JSON",
subtitle="Minify JSON from Clipboard",
)
@with_clip
def... | [
"json.loads",
"json.dumps",
"genie.uid"
] | [((395, 427), 'json.loads', 'json.loads', (['input_from_clipboard'], {}), '(input_from_clipboard)\n', (405, 427), False, 'import json\n'), ((447, 491), 'json.dumps', 'json.dumps', (['json_temp'], {'separators': "(',', ':')"}), "(json_temp, separators=(',', ':'))\n", (457, 491), False, 'import json\n'), ((174, 180), 'ge... |
from rest_framework import serializers
from .models import (
Program,
ComponentProgram,
Course,
Preparation,
Activity,
Assessment,
Artifact,
Strategy,
Node,
NodeStrategy,
StrategyActivity,
ComponentWeek,
WeekCourse,
Component,
Week,
Discipline,
Outcome... | [
"rest_framework.serializers.SlugRelatedField",
"rest_framework.serializers.SerializerMethodField"
] | [((773, 840), 'rest_framework.serializers.SlugRelatedField', 'serializers.SlugRelatedField', ([], {'read_only': '(True)', 'slug_field': '"""username"""'}), "(read_only=True, slug_field='username')\n", (801, 840), False, 'from rest_framework import serializers\n'), ((2265, 2332), 'rest_framework.serializers.SlugRelatedF... |
import sys
import math
def euclides( m, n):
x0, x1 = 1, 0
y0, y1 = 0, 1
r0, r1 = m, n
r, i = n, 2
c = 0
while r != 0:
q = int(r0 / r1)
x = x1 * q + x0
y = y1 * q + y0
res = r0 % r1
print("{} = {} * {} + {}".format(int(r0), int(r1), int(q), int(res)))
... | [
"math.pow"
] | [((498, 513), 'math.pow', 'math.pow', (['(-1)', 'i'], {}), '(-1, i)\n', (506, 513), False, 'import math\n'), ((527, 546), 'math.pow', 'math.pow', (['(-1)', '(i - 1)'], {}), '(-1, i - 1)\n', (535, 546), False, 'import math\n'), ((328, 343), 'math.pow', 'math.pow', (['(-1)', 'i'], {}), '(-1, i)\n', (336, 343), False, 'im... |
from fractions import Fraction
from functools import partial
from hypothesis import strategies
MAX_NUMBER = 10 ** 10
MIN_NUMBER = -MAX_NUMBER
coordinates_strategies_factories = {
float: partial(strategies.floats,
allow_nan=False,
allow_infinity=False),
Fraction: partial(s... | [
"functools.partial"
] | [((192, 257), 'functools.partial', 'partial', (['strategies.floats'], {'allow_nan': '(False)', 'allow_infinity': '(False)'}), '(strategies.floats, allow_nan=False, allow_infinity=False)\n', (199, 257), False, 'from functools import partial\n'), ((311, 368), 'functools.partial', 'partial', (['strategies.fractions'], {'m... |
import numpy as np
from sklearn import svm
from data_loader import data_loader
N = 100
NUM_CLASS = 4
data_dir = "C:\\Users\\wsy\\Documents\\Audio\\*.m4a"
data_X, data_Y = data_loader(data_dir)
print(len(data_X))
clf_list = []
for idx in range(NUM_CLASS):
for i, X in enumerate(data_X):
if ... | [
"data_loader.data_loader",
"numpy.zeros",
"sklearn.svm.LinearSVC"
] | [((181, 202), 'data_loader.data_loader', 'data_loader', (['data_dir'], {}), '(data_dir)\n', (192, 202), False, 'from data_loader import data_loader\n'), ((681, 700), 'numpy.zeros', 'np.zeros', (['NUM_CLASS'], {}), '(NUM_CLASS)\n', (689, 700), True, 'import numpy as np\n'), ((397, 412), 'sklearn.svm.LinearSVC', 'svm.Lin... |
from django.contrib import messages
from django.contrib.auth.decorators import login_required
from django.contrib.contenttypes.models import ContentType
from django.http import Http404, HttpResponse, HttpResponseRedirect
from django.shortcuts import render
from .forms import CommentForm
from .models import Comment
@... | [
"django.shortcuts.render",
"django.http.HttpResponse",
"django.contrib.contenttypes.models.ContentType.objects.get",
"django.contrib.messages.success"
] | [((842, 894), 'django.shortcuts.render', 'render', (['request', '"""delete.html"""', "{'comment': comment}"], {}), "(request, 'delete.html', {'comment': comment})\n", (848, 894), False, 'from django.shortcuts import render\n'), ((2344, 2410), 'django.shortcuts.render', 'render', (['request', '"""thread.html"""', "{'com... |
from django.contrib.contenttypes.fields import GenericRelation
from django.db import models
from openbook_notifications.models.notification import Notification
from openbook_posts.models import PostReaction
class PostReactionNotification(models.Model):
notification = GenericRelation(Notification, related_name='po... | [
"django.db.models.ForeignKey",
"openbook_notifications.models.notification.Notification.create_notification",
"django.contrib.contenttypes.fields.GenericRelation"
] | [((274, 347), 'django.contrib.contenttypes.fields.GenericRelation', 'GenericRelation', (['Notification'], {'related_name': '"""post_reaction_notifications"""'}), "(Notification, related_name='post_reaction_notifications')\n", (289, 347), False, 'from django.contrib.contenttypes.fields import GenericRelation\n'), ((368,... |
import xarray as xr
from.np_deterministic import _pearson_r, _pearson_r_p_value, _rmse
__all__ = ['pearson_r', 'rmse']
def pearson_r(a, b, dim):
"""
Pearson's correlation coefficient.
Parameters
----------
a : Dataset, DataArray, GroupBy, Variable, numpy/dask arrays or scalars
Mix of ... | [
"xarray.apply_ufunc"
] | [((920, 1010), 'xarray.apply_ufunc', 'xr.apply_ufunc', (['_pearson_r', 'a', 'b'], {'input_core_dims': '[[dim], [dim]]', 'kwargs': "{'axis': -1}"}), "(_pearson_r, a, b, input_core_dims=[[dim], [dim]], kwargs={\n 'axis': -1})\n", (934, 1010), True, 'import xarray as xr\n'), ((1887, 1984), 'xarray.apply_ufunc', 'xr.app... |
import pandas as pd
from IPython.core.display import display, HTML
def table(data,
title="Descriptive Stats",
sub_title="",
table_width=630,
indexcol_width=150,
return_html=False):
'''Displays a publication quality data table
with any number of columns and a... | [
"IPython.core.display.HTML"
] | [((4932, 4942), 'IPython.core.display.HTML', 'HTML', (['html'], {}), '(html)\n', (4936, 4942), False, 'from IPython.core.display import display, HTML\n')] |
#!/usr/bin/python
"""class Strategy"""
import models
from models.base_model import BaseModel, Base
from sqlalchemy import Column, String, Float, ForeignKey
from sqlalchemy.orm import relationship
class Strategy(BaseModel, Base):
"""Representation of a Strategy"""
__tablename__ = 'strategies'
name = Colum... | [
"sqlalchemy.orm.relationship",
"sqlalchemy.String",
"sqlalchemy.Column"
] | [((367, 456), 'sqlalchemy.orm.relationship', 'relationship', (['"""Backtest"""'], {'backref': '"""strategies"""', 'cascade': '"""all, delete, delete-orphan"""'}), "('Backtest', backref='strategies', cascade=\n 'all, delete, delete-orphan')\n", (379, 456), False, 'from sqlalchemy.orm import relationship\n'), ((584, 6... |
# Copyright 2016 The Johns Hopkins University Applied Physics Laboratory
#
# 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 ... | [
"bosscore.serializers.ChannelSerializer",
"bossutils.logger.bossLogger",
"bosscore.models.Experiment.objects.all",
"bosscore.models.CoordinateFrame.objects.filter",
"bosscore.models.Collection.objects.filter",
"bosscore.serializers.ChannelUpdateSerializer",
"copy.deepcopy",
"bosscore.lookup.LookUpKey.... | [((1771, 1783), 'bossutils.configuration.BossConfig', 'BossConfig', ([], {}), '()\n', (1781, 1783), False, 'from bossutils.configuration import BossConfig\n'), ((3413, 3443), 'bosscore.privileges.check_role', 'check_role', (['"""resource-manager"""'], {}), "('resource-manager')\n", (3423, 3443), False, 'from bosscore.p... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
"""
This is the pygame minimal example.
"""
__revision__ = "$Rev$"
__version__ = "3.0.0." + __revision__[6:-2]
__author__ = 'DR0ID @ 2009-2011'
import sys
import os
try:
import _path
except:
pass
import tiledtmxloader
# ----------------------------------------... | [
"tiledtmxloader.tmxreader.TileMapParser",
"os.path.join",
"os.path.basename"
] | [((472, 508), 'os.path.join', 'os.path.join', (['os.pardir', '"""001-1.tmx"""'], {}), "(os.pardir, '001-1.tmx')\n", (484, 508), False, 'import os\n'), ((1014, 1054), 'tiledtmxloader.tmxreader.TileMapParser', 'tiledtmxloader.tmxreader.TileMapParser', ([], {}), '()\n', (1052, 1054), False, 'import tiledtmxloader\n'), ((6... |
# Generated by Django 3.0.2 on 2020-02-17 03:13
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('projects', '0009_auto_20200217_0306'),
]
operations = [
migrations.AlterField(
model_name='profile',
name='profile_p... | [
"django.db.models.ImageField"
] | [((343, 421), 'django.db.models.ImageField', 'models.ImageField', ([], {'blank': '(True)', 'default': '"""default.png"""', 'upload_to': '"""profile_pics"""'}), "(blank=True, default='default.png', upload_to='profile_pics')\n", (360, 421), False, 'from django.db import migrations, models\n')] |
import os
import hashlib
def getHash(f):
line=f.readline()
hash=hashlib.md5()
while(line):
hash.update(line)
line=f.readline()
return hash.hexdigest()
def IsHashEqual(f1,f2):
str1=getHash(f1)
str2=getHash(f2)
return str1==str2
if __name__ == '__main__':
cmds = []
ans = []
cmd = "./... | [
"os.system",
"hashlib.md5"
] | [((69, 82), 'hashlib.md5', 'hashlib.md5', ([], {}), '()\n', (80, 82), False, 'import hashlib\n'), ((805, 823), 'os.system', 'os.system', (['cmds[i]'], {}), '(cmds[i])\n', (814, 823), False, 'import os\n')] |
# -*- coding: utf-8 -*-
# @Time : 2017/8/2 10:46
# @Author : play4fun
# @File : test_video.py
# @Software: PyCharm
"""
test_video.py:
"""
import numpy as np
import cv2
from matplotlib import pyplot as plt
cap = cv2.VideoCapture('../../data/vtest.avi')#不支持读取视频
# cap = cv2.VideoCapture('output.avi')
# cap = cv2... | [
"matplotlib.pyplot.imshow",
"cv2.VideoCapture",
"matplotlib.pyplot.show"
] | [((221, 261), 'cv2.VideoCapture', 'cv2.VideoCapture', (['"""../../data/vtest.avi"""'], {}), "('../../data/vtest.avi')\n", (237, 261), False, 'import cv2\n'), ((1131, 1148), 'matplotlib.pyplot.imshow', 'plt.imshow', (['frame'], {}), '(frame)\n', (1141, 1148), True, 'from matplotlib import pyplot as plt\n'), ((1210, 1220... |
#API setup
from picraft import Vector
from picraft import World, Block
def translate_left(position, data):
if data == 0:
return position - Vector(z=1)
elif data == 1:
return position + Vector(z=1)
elif data == 2:
return position + Vector(x=1)
else:
return position - Vector(x=1)
def translate_right(positio... | [
"picraft.Vector",
"picraft.Block",
"picraft.World"
] | [((1065, 1080), 'picraft.Block', 'Block', (['(53)', 'data'], {}), '(53, data)\n', (1070, 1080), False, 'from picraft import World, Block\n'), ((1209, 1228), 'picraft.Block', 'Block', (['(53)', 'new_data'], {}), '(53, new_data)\n', (1214, 1228), False, 'from picraft import World, Block\n'), ((1364, 1383), 'picraft.Block... |
import json
#json does not support int type key in dictionary,
#so I created this function to do that.
def str_key2int(str_key_dic):
int_key_dic = dict()
for strkey in str_key_dic:
int_key_dic[int(strkey)] = str_key_dic[strkey]
return int_key_dic
def dum_config():
dict_json = {'NU... | [
"json.load",
"json.dump"
] | [((850, 869), 'json.load', 'json.load', (['out_file'], {}), '(out_file)\n', (859, 869), False, 'import json\n'), ((656, 696), 'json.dump', 'json.dump', (['dict_json', 'out_file'], {'indent': '(4)'}), '(dict_json, out_file, indent=4)\n', (665, 696), False, 'import json\n'), ((1332, 1351), 'json.load', 'json.load', (['ou... |
import unittest
from nzmath.rational import *
import nzmath.finitefield as finitefield
from nzmath.plugins import FLOATTYPE as Float
# Rational, Integer, theIntegerRing, theRationalField
class RationalTest (unittest.TestCase):
def testInit(self):
self.assertEqual("2/1", str(Rational(2)))
self.asse... | [
"unittest.TestSuite",
"nzmath.finitefield.FinitePrimeFieldElement",
"unittest.makeSuite",
"nzmath.plugins.FLOATTYPE",
"unittest.TextTestRunner"
] | [((14236, 14256), 'unittest.TestSuite', 'unittest.TestSuite', ([], {}), '()\n', (14254, 14256), False, 'import unittest\n'), ((14473, 14498), 'unittest.TextTestRunner', 'unittest.TextTestRunner', ([], {}), '()\n', (14496, 14498), False, 'import unittest\n'), ((766, 807), 'nzmath.finitefield.FinitePrimeFieldElement', 'f... |
from django.urls import reverse
import pytest
@pytest.mark.parametrize('url_name', (
'schema-swagger-ui',
'schema-redoc',
))
def test_docs(url_name, client):
url = reverse(url_name)
response = client.get(url)
assert response.status_code == 200
@pytest.mark.parametrize('response_format',... | [
"pytest.mark.parametrize",
"django.urls.reverse"
] | [((50, 124), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""url_name"""', "('schema-swagger-ui', 'schema-redoc')"], {}), "('url_name', ('schema-swagger-ui', 'schema-redoc'))\n", (73, 124), False, 'import pytest\n'), ((278, 340), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""response_format"""... |
from rest_framework import request
from rest_framework.viewsets import ModelViewSet
from django.db.models import Q
from docker_host.permissions import IsHostOperationAllowed, HostOperationMixin
from .models import Note
from .serializer import NoteSerializer
class NoteView(ModelViewSet, HostOperationMixin):
quer... | [
"django.db.models.Q"
] | [((644, 661), 'django.db.models.Q', 'Q', ([], {'is_public': '(True)'}), '(is_public=True)\n', (645, 661), False, 'from django.db.models import Q\n'), ((664, 692), 'django.db.models.Q', 'Q', ([], {'creator': 'self.request.user'}), '(creator=self.request.user)\n', (665, 692), False, 'from django.db.models import Q\n')] |
import numpy as np
#create array of weekly vaccination numbers from https://opendata-geohive.hub.arcgis.com/datasets/0101ed10351e42968535bb002f94c8c6_0.csv?outSR=%7B%22latestWkid%22%3A3857%2C%22wkid%22%3A102100%7D
a= np.array([3946,
43856,
52659,
49703,
51381,
56267,
32176,
86434,
88578,
88294,
91298,
64535,
133195,
... | [
"numpy.array",
"numpy.min"
] | [((219, 633), 'numpy.array', 'np.array', (['[3946, 43856, 52659, 49703, 51381, 56267, 32176, 86434, 88578, 88294, 91298,\n 64535, 133195, 139946, 131038, 155716, 188626, 211497, 245947, 323166, \n 331292, 305479, 277195, 290362, 357077, 370059, 370544, 390891, 373319,\n 336086, 300378, 232066, 232234, 229694, ... |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.23 on 2020-09-10 14:23
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
("chroma_core", "0024_mountsnapshotjob_unmountsnapshotjob"),... | [
"django.db.models.OneToOneField",
"django.db.models.CharField",
"django.db.models.BooleanField"
] | [((507, 676), 'django.db.models.OneToOneField', 'models.OneToOneField', ([], {'auto_created': '(True)', 'on_delete': 'django.db.models.deletion.CASCADE', 'parent_link': '(True)', 'primary_key': '(True)', 'serialize': '(False)', 'to': '"""chroma_core.Job"""'}), "(auto_created=True, on_delete=django.db.models.deletion\n ... |
#!/usr/bin/env python
from setuptools import setup, find_packages
#if sys.argv[-1] == 'publish':
# os.system('python setup.py sdist upload')
# sys.exit()
with open('bace/__init__.py') as fid:
for line in fid:
if line.startswith('__version__'):
VERSION = line.strip().split()[-1][1:-1]
... | [
"setuptools.find_packages"
] | [((804, 845), 'setuptools.find_packages', 'find_packages', ([], {'where': '"""."""', 'exclude': '"""tests"""'}), "(where='.', exclude='tests')\n", (817, 845), False, 'from setuptools import setup, find_packages\n')] |
#!/usr/bin/env python3
#
# Author: <NAME>
# Copyright 2015-present, NASA-JPL/Caltech
#
import os
import glob
import datetime
import numpy as np
import isce, isceobj
from isceobj.Alos2Proc.runSwathOffset import swathOffset
from StackPulic import loadTrack
from StackPulic import acquisitionModesAlos2
def cmdLinePar... | [
"StackPulic.acquisitionModesAlos2",
"argparse.ArgumentParser",
"os.makedirs",
"isceobj.Alos2Proc.runSwathOffset.swathOffset",
"os.path.join",
"StackPulic.loadTrack",
"os.getcwd",
"os.chdir",
"sys.exit"
] | [((416, 476), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""estimate swath offset"""'}), "(description='estimate swath offset')\n", (439, 476), False, 'import argparse\n'), ((1623, 1646), 'StackPulic.acquisitionModesAlos2', 'acquisitionModesAlos2', ([], {}), '()\n', (1644, 1646), False,... |
# Generated by Django 2.1 on 2018-10-10 22:21
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('login', '0004_auto_20181010_1640'),
]
operations = [
migrations.AddField(
model_name='employee',
name='Username',
... | [
"django.db.models.CharField"
] | [((334, 381), 'django.db.models.CharField', 'models.CharField', ([], {'default': '"""None"""', 'max_length': '(50)'}), "(default='None', max_length=50)\n", (350, 381), False, 'from django.db import migrations, models\n')] |
import asyncio
import logging
import os
from time import time
from yarl import URL
from ..client.client import Client
from ..client.request import HTTPMethod, Request
from .asynctest import AsyncTest
class TestClient(AsyncTest):
@classmethod
def setUpClass(cls):
logger = logging.getLogger('client')... | [
"logging.getLogger",
"logging.StreamHandler",
"logging.Formatter",
"asyncio.sleep",
"yarl.URL",
"time.time",
"os.remove"
] | [((293, 320), 'logging.getLogger', 'logging.getLogger', (['"""client"""'], {}), "('client')\n", (310, 320), False, 'import logging\n'), ((425, 486), 'logging.Formatter', 'logging.Formatter', (['"""%(asctime)s - %(levelname)s: %(message)s"""'], {}), "('%(asctime)s - %(levelname)s: %(message)s')\n", (442, 486), False, 'i... |
#########################################
## Written by <EMAIL>
## Script to update the desiredCount (# of tasks) for all services have less running than desired.
#########################################
### Parameters ###
cluster = ''
region = ''
desiredCount = 0
# AWS Profile Name (Optional)
profile_name = ''
###... | [
"boto3.client",
"boto3.session.Session"
] | [((463, 511), 'boto3.session.Session', 'boto3.session.Session', ([], {'profile_name': 'profile_name'}), '(profile_name=profile_name)\n', (484, 511), False, 'import boto3\n'), ((678, 717), 'boto3.client', 'boto3.client', (['"""ecs"""'], {'region_name': 'region'}), "('ecs', region_name=region)\n", (690, 717), False, 'imp... |
import json
from datetime import timedelta
import dateutil.parser
from flask import Blueprint, request
from app.models.main import Channel, Performer, Song, Play
# Response codes
CODE_KO = 1
CODE_OK = 0
music_ws = Blueprint('music_ws', __name__)
@music_ws.route('/', methods=['GET'])
def index():
return 'Hello... | [
"app.models.main.Performer.objects",
"json.dumps",
"app.models.main.Play._get_collection",
"app.models.main.Play.objects",
"app.models.main.Song.objects",
"flask.request.values.get",
"datetime.timedelta",
"flask.Blueprint",
"app.models.main.Channel.objects"
] | [((218, 249), 'flask.Blueprint', 'Blueprint', (['"""music_ws"""', '__name__'], {}), "('music_ws', __name__)\n", (227, 249), False, 'from flask import Blueprint, request\n'), ((483, 496), 'json.dumps', 'json.dumps', (['r'], {}), '(r)\n', (493, 496), False, 'import json\n'), ((596, 626), 'flask.request.values.get', 'requ... |
from django.core.validators import MinValueValidator
from django.db import models
from django.utils.translation import ugettext_lazy as _
from core.models import AbstractBaseModel
class RevenueGroup(AbstractBaseModel):
name = models.CharField(_('Name'), max_length=255, unique=True)
revenue_from = models.Deci... | [
"django.core.validators.MinValueValidator",
"django.utils.translation.ugettext_lazy"
] | [((250, 259), 'django.utils.translation.ugettext_lazy', '_', (['"""Name"""'], {}), "('Name')\n", (251, 259), True, 'from django.utils.translation import ugettext_lazy as _\n'), ((329, 338), 'django.utils.translation.ugettext_lazy', '_', (['"""From"""'], {}), "('From')\n", (330, 338), True, 'from django.utils.translatio... |
# -*- coding: utf-8 -*-
"""
Written by <NAME>
Email: danaukes<at>gmail.com
Please see LICENSE for full license.
"""
import sympy
import pynamics
class Vector(object):
def __init__(self,components=None):
self.components = {}
components=components or {}
for frame,vec in components.items():
... | [
"sympy.Matrix",
"sympy.Matrix.dot",
"sympy.Matrix.cross",
"sympy.Number",
"pynamics.get_system"
] | [((1929, 1944), 'sympy.Number', 'sympy.Number', (['(0)'], {}), '(0)\n', (1941, 1944), False, 'import sympy\n'), ((3211, 3271), 'sympy.Matrix.dot', 'sympy.Matrix.dot', (['v1.components[frame]', 'v2.components[frame]'], {}), '(v1.components[frame], v2.components[frame])\n', (3227, 3271), False, 'import sympy\n'), ((9188,... |
# Copyright 2018 Amazon.com, Inc. or its affiliates. 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. A copy of
# the License is located at
#
# http://aws.amazon.com/apache2.0/
#
# or in the "license" file accompa... | [
"uuid.uuid4"
] | [((1311, 1323), 'uuid.uuid4', 'uuid.uuid4', ([], {}), '()\n', (1321, 1323), False, 'import uuid\n')] |
from django.urls import path, include
from rest_framework import routers
from . import views
router = routers.DefaultRouter()
router.register("category", views.CategoryViewSet)
router.register("product", views.ProductViewSet)
urlpatterns = [
path("", 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'), ((257, 277), 'django.urls.include', 'include', (['router.urls'], {}), '(router.urls)\n', (264, 277), False, 'from django.urls import path, include\n')] |
import numpy as np
import pandas as pd
data = pd.DataFrame(data=pd.read_csv('enjoysport.csv'))
concepts = np.array(data.iloc[:,0:-1])
print('Concepts:', concepts)
target = np.array(data.iloc[:,-1])
print('Target:', target)
def learn(concepts, target):
print("Initialization of specific_h and general_... | [
"numpy.array",
"pandas.read_csv"
] | [((111, 139), 'numpy.array', 'np.array', (['data.iloc[:, 0:-1]'], {}), '(data.iloc[:, 0:-1])\n', (119, 139), True, 'import numpy as np\n'), ((180, 206), 'numpy.array', 'np.array', (['data.iloc[:, -1]'], {}), '(data.iloc[:, -1])\n', (188, 206), True, 'import numpy as np\n'), ((67, 96), 'pandas.read_csv', 'pd.read_csv', ... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#######################################
#-------------------------------------#
# Module: Frontera Eficiente #
#-------------------------------------#
# Creado: #
# 20. 04. 2019 #
# Ult. modificacion: ... | [
"matplotlib.pylab.xticks",
"matplotlib.pylab.subplots",
"numpy.sqrt",
"pandas.read_csv",
"numpy.array",
"matplotlib.pylab.show",
"pandas.ewma",
"numpy.mean",
"seaborn.set",
"numpy.random.random",
"matplotlib.pylab.legend",
"matplotlib.pylab.title",
"pandas.DataFrame.from_dict",
"numpy.lins... | [((695, 718), 'seaborn.set', 'sns.set', ([], {'font_scale': '(1.5)'}), '(font_scale=1.5)\n', (702, 718), True, 'import seaborn as sns\n'), ((968, 1030), 'warnings.simplefilter', 'warnings.simplefilter', ([], {'action': '"""ignore"""', 'category': 'FutureWarning'}), "(action='ignore', category=FutureWarning)\n", (989, 1... |
# Generated by Django 3.2.8 on 2021-10-13 11:30
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('collector', '0023_node_benchmark_score'),
]
operations = [
migrations.AddField(
model_name='node',
name='benchmarked... | [
"django.db.models.DateTimeField"
] | [((344, 387), 'django.db.models.DateTimeField', 'models.DateTimeField', ([], {'blank': '(True)', 'null': '(True)'}), '(blank=True, null=True)\n', (364, 387), False, 'from django.db import migrations, models\n')] |
import numpy as np
import matplotlib.pyplot as plt
from scipy.linalg import norm as lpnorm
if __name__ == "__main__":
N = 1000 # Precision
p = 0.5 # p-norm
# Discretize unit-circle
angles = np.linspace(0, 2*np.pi, N)
# Create unit-circle points
points = np.stack((np.cos(angles), np.sin(... | [
"matplotlib.pyplot.gca",
"matplotlib.pyplot.plot",
"numpy.linspace",
"numpy.cos",
"scipy.linalg.norm",
"numpy.sin",
"matplotlib.pyplot.show"
] | [((215, 243), 'numpy.linspace', 'np.linspace', (['(0)', '(2 * np.pi)', 'N'], {}), '(0, 2 * np.pi, N)\n', (226, 243), True, 'import numpy as np\n'), ((460, 511), 'matplotlib.pyplot.plot', 'plt.plot', (['points[:, 0]', 'points[:, 1]'], {'linestyle': '"""-"""'}), "(points[:, 0], points[:, 1], linestyle='-')\n", (468, 511)... |
"""Test state getters for retrieving motion planning views of state."""
import pytest
from decoy import Decoy
from dataclasses import dataclass, field
from typing import Optional
from opentrons.types import Point, MountType
from opentrons.hardware_control.types import CriticalPoint
from opentrons.protocols.geometry.pl... | [
"opentrons.protocols.geometry.planning.get_waypoints",
"opentrons.protocol_engine.types.DeckLocation",
"dataclasses.dataclass",
"opentrons.protocol_engine.state.motion.MotionView",
"opentrons.protocol_engine.state.PipetteData",
"pytest.raises",
"opentrons.types.Point",
"opentrons.protocol_engine.state... | [((4834, 4856), 'dataclasses.dataclass', 'dataclass', ([], {'frozen': '(True)'}), '(frozen=True)\n', (4843, 4856), False, 'from dataclasses import dataclass, field\n'), ((1071, 1168), 'opentrons.protocol_engine.state.motion.MotionView', 'MotionView', ([], {'labware_view': 'labware_view', 'pipette_view': 'pipette_view',... |
import numpy as np
from .. import T
from ..layer import ShapedLayer
from ..initialization import initialize_weights
from .full import Linear
from .. import stats
__all__ = ['Gaussian', 'Bernoulli', 'IdentityVariance']
class Gaussian(Linear):
def __init__(self, *args, **kwargs):
self.cov_type = kwargs.p... | [
"numpy.zeros",
"numpy.sqrt"
] | [((1005, 1024), 'numpy.zeros', 'np.zeros', (['[dim_out]'], {}), '([dim_out])\n', (1013, 1024), True, 'import numpy as np\n'), ((2690, 2712), 'numpy.sqrt', 'np.sqrt', (['self.variance'], {}), '(self.variance)\n', (2697, 2712), True, 'import numpy as np\n')] |
from django import forms
from pbs.implementation.models import BurningPrescription, EdgingPlan, LightingSequence
from pbs.forms import HelperModelForm, WideTextarea
class BurningPrescriptionForm(forms.ModelForm):
class Meta:
model = BurningPrescription
fields = ('prescription', 'fuel_type', 'scor... | [
"pbs.forms.WideTextarea"
] | [((559, 573), 'pbs.forms.WideTextarea', 'WideTextarea', ([], {}), '()\n', (571, 573), False, 'from pbs.forms import HelperModelForm, WideTextarea\n'), ((617, 631), 'pbs.forms.WideTextarea', 'WideTextarea', ([], {}), '()\n', (629, 631), False, 'from pbs.forms import HelperModelForm, WideTextarea\n'), ((948, 962), 'pbs.f... |
# DExTer : Debugging Experience Tester
# ~~~~~~ ~ ~~ ~ ~~
#
# Copyright (c) 2018 by SN Systems Ltd., Sony Interactive Entertainment Inc.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# ... | [
"dex.utils.Exceptions.Error",
"dex.utils.Timer",
"dex.debugger.Debuggers.Debuggers",
"dex.debugger.Debuggers.add_debugger_tool_arguments1",
"dex.debugger.Debuggers.handle_debugger_tool_options1"
] | [((1883, 1929), 'dex.debugger.Debuggers.add_debugger_tool_arguments1', 'add_debugger_tool_arguments1', (['parser', 'defaults'], {}), '(parser, defaults)\n', (1911, 1929), False, 'from dex.debugger.Debuggers import add_debugger_tool_arguments1\n'), ((1979, 2032), 'dex.debugger.Debuggers.handle_debugger_tool_options1', '... |
import pytest
from coloring import create_color
from coloring.consts import *
def test_create_color():
text = "Hello"
mycolor = create_color(120, 160, 200)
colored_text = mycolor(text)
assert colored_text == f"{CSI}38;2;120;160;200m{text}{RESET_COLOR}"
mycolor = create_color(128, 128, 128)
c... | [
"coloring.create_color",
"pytest.raises"
] | [((139, 166), 'coloring.create_color', 'create_color', (['(120)', '(160)', '(200)'], {}), '(120, 160, 200)\n', (151, 166), False, 'from coloring import create_color\n'), ((287, 314), 'coloring.create_color', 'create_color', (['(128)', '(128)', '(128)'], {}), '(128, 128, 128)\n', (299, 314), False, 'from coloring import... |
from setuptools import setup
setup(name='embed',
version='0.1',
description='Basic immplementation of knowledge graph embedding. ',
url='https://github.com/pbloem/embed',
author='<NAME>',
author_email='<EMAIL>',
license='MIT',
packages=['embed'],
install_requires=[
... | [
"setuptools.setup"
] | [((30, 333), 'setuptools.setup', 'setup', ([], {'name': '"""embed"""', 'version': '"""0.1"""', 'description': '"""Basic immplementation of knowledge graph embedding. """', 'url': '"""https://github.com/pbloem/embed"""', 'author': '"""<NAME>"""', 'author_email': '"""<EMAIL>"""', 'license': '"""MIT"""', 'packages': "['em... |
import os
import sys
import unittest
# Make sure the path of the framework is included in the import path
sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), '../src/')))
# Framework imports
from mdp import Sokoban, SokobanBuilder
class TestSokoban(unittest.TestCase):
def test_builder... | [
"os.path.dirname",
"mdp.SokobanBuilder"
] | [((347, 390), 'mdp.SokobanBuilder', 'SokobanBuilder', ([], {'level_name': '"""suitcase-05-01"""'}), "(level_name='suitcase-05-01')\n", (361, 390), False, 'from mdp import Sokoban, SokobanBuilder\n'), ((2187, 2230), 'mdp.SokobanBuilder', 'SokobanBuilder', ([], {'level_name': '"""suitcase-05-01"""'}), "(level_name='suitc... |
"""Strip user paths from Jupyter notebook."""
import json
import os
import re
import sys
from pathlib import Path
from typing import Iterator, Mapping, Optional, Sequence
from nb_strip_paths.cmdline import CLIArgs
from nb_strip_paths.find_root import find_project_root
EXCLUDES = (
r"/("
r"\.direnv|\.eggs|\.g... | [
"re.compile",
"pathlib.Path",
"json.dumps",
"sys.exit",
"nb_strip_paths.cmdline.CLIArgs.parse_args"
] | [((4640, 4664), 'nb_strip_paths.cmdline.CLIArgs.parse_args', 'CLIArgs.parse_args', (['argv'], {}), '(argv)\n', (4658, 4664), False, 'from nb_strip_paths.cmdline import CLIArgs\n'), ((4804, 4825), 'sys.exit', 'sys.exit', (['output_code'], {}), '(output_code)\n', (4812, 4825), False, 'import sys\n'), ((1564, 1583), 're.c... |
"""WARNING Just an experiment - please ignore this."""
from i3configger import config
BINDCODE = "bindcode"
BINDSYM = "bindsym"
class Bindings:
"""
bindsym | bindcode
[--release] [<Group>+][<Modifiers>+]<keysym> command
[--release] [--border] [--whole-window] [<Modifiers>+]button<n> command
"""
... | [
"i3configger.config.I3configgerConfig"
] | [((1263, 1289), 'i3configger.config.I3configgerConfig', 'config.I3configgerConfig', ([], {}), '()\n', (1287, 1289), False, 'from i3configger import config\n')] |
import numpy as np
#DEFINE INNER FUNCTIONS
def inv_log_func(x, a, b):
return ((a * starting_score) / (2 + np.log(b * x)))
def bump_func(x,e):
return (e * np.sin(x - np.pi / 2)) + e
def sin_vals(ampl,steps):
if (steps < 1): steps = 1
sin_step = (np.pi * 2.0) / steps
x_range = np.arange(0,np.pi * 2... | [
"numpy.log",
"numpy.asarray",
"numpy.random.seed",
"numpy.savetxt",
"numpy.random.uniform",
"numpy.sin",
"numpy.arange"
] | [((2457, 2496), 'numpy.arange', 'np.arange', (['range_start', 'range_end', 'step'], {}), '(range_start, range_end, step)\n', (2466, 2496), True, 'import numpy as np\n'), ((2511, 2536), 'numpy.random.seed', 'np.random.seed', (['rand_seed'], {}), '(rand_seed)\n', (2525, 2536), True, 'import numpy as np\n'), ((2709, 2730)... |
from pynput import keyboard
import sys
import socket
import requests
import json
import logging
import configparser
config = configparser.ConfigParser()
config.read('config.ini')
FILENAME = config['DEFAULT']['FILENAME']
LOG_DIR = config['DEFAULT']['LOG_DIR']
LOGFILE = config['DEFAULT']['LOGFILE']
ESCAPE_STRING = conf... | [
"logging.basicConfig",
"pynput.keyboard.Listener",
"requests.post",
"configparser.ConfigParser",
"json.dumps",
"sys.exit",
"socket.gethostname",
"logging.info",
"logging.error"
] | [((126, 153), 'configparser.ConfigParser', 'configparser.ConfigParser', ([], {}), '()\n', (151, 153), False, 'import configparser\n'), ((468, 488), 'socket.gethostname', 'socket.gethostname', ([], {}), '()\n', (486, 488), False, 'import socket\n'), ((490, 598), 'logging.basicConfig', 'logging.basicConfig', ([], {'filen... |
import tenjin
from tenjin.helpers import *
import cgi
engine = tenjin.Engine(path=['views'], escapefunc="cgi.escape", tostrfunc="str")
print(engine.get_template('page.pyhtml').script)
| [
"tenjin.Engine"
] | [((63, 134), 'tenjin.Engine', 'tenjin.Engine', ([], {'path': "['views']", 'escapefunc': '"""cgi.escape"""', 'tostrfunc': '"""str"""'}), "(path=['views'], escapefunc='cgi.escape', tostrfunc='str')\n", (76, 134), False, 'import tenjin\n')] |
# 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 applicable law or agreed to in... | [
"tarfile.open",
"io.BytesIO"
] | [((794, 806), 'io.BytesIO', 'io.BytesIO', ([], {}), '()\n', (804, 806), False, 'import io\n'), ((820, 856), 'tarfile.open', 'tarfile.open', ([], {'fileobj': 'f', 'mode': '"""w:gz"""'}), "(fileobj=f, mode='w:gz')\n", (832, 856), False, 'import tarfile\n')] |
import os
import traceback
from ToolBox import utils
class SelectInterface():
def __init__(self, options=None):
if options is None:
options = {}
self.options = options
# options should be a dict
def add_option(self, option, alias=None):
if type(alias) ... | [
"traceback.format_exc",
"ToolBox.utils.list2csv",
"ToolBox.utils.remove_blank_in_endpoint",
"ToolBox.utils.is_blank",
"ToolBox.utils.detect_platform",
"os.system"
] | [((2457, 2480), 'ToolBox.utils.detect_platform', 'utils.detect_platform', ([], {}), '()\n', (2478, 2480), False, 'from ToolBox import utils\n'), ((7691, 7730), 'ToolBox.utils.remove_blank_in_endpoint', 'utils.remove_blank_in_endpoint', (['command'], {}), '(command)\n', (7721, 7730), False, 'from ToolBox import utils\n'... |
#################################################################################################
# #
# MULTI-ARMED BANDITS ---- 10-ARM TESTBED SOFTMAX METHOD #
# #
# Author: <NAME> #
# #
# References: ... | [
"numpy.random.normal",
"numpy.mean",
"numpy.ones",
"numpy.argmax",
"numpy.exp",
"numpy.sum",
"numpy.zeros",
"matplotlib.pyplot.figure",
"time.time",
"matplotlib.pyplot.show"
] | [((843, 854), 'time.time', 'time.time', ([], {}), '()\n', (852, 854), False, 'import time\n'), ((1058, 1088), 'numpy.random.normal', 'np.random.normal', (['(0)', '(1)', '(n, k)'], {}), '(0, 1, (n, k))\n', (1074, 1088), True, 'import numpy as np\n'), ((1135, 1152), 'numpy.argmax', 'np.argmax', (['q_t', '(1)'], {}), '(q_... |
#!/usr/local/bin/python3
import os
import subprocess
from subprocess import Popen, PIPE, STDOUT
from configparser import ConfigParser
import subprocess
import plexapi
import schedule
import time
from datetime import datetime
import re
from colorama import Fore, Back, Style
import socket
from urllib import... | [
"plexapi.server.PlexServer",
"urllib.parse.urlparse",
"configparser.ConfigParser",
"re.compile",
"subprocess.Popen",
"socket.inet_aton"
] | [((386, 400), 'configparser.ConfigParser', 'ConfigParser', ([], {}), '()\n', (398, 400), False, 'from configparser import ConfigParser\n'), ((3570, 3603), 're.compile', 're.compile', (['"""^[0-9]{2}:[0-9]{2}$"""'], {}), "('^[0-9]{2}:[0-9]{2}$')\n", (3580, 3603), False, 'import re\n'), ((4619, 4662), 'subprocess.Popen',... |
from django.db import models
from account.models import User
from django.utils import timezone
from django.utils.text import slugify
class Post(models.Model):
author = models.ForeignKey(to=User,
on_delete=models.SET_NULL,
related_name='feed_posts',
... | [
"django.utils.text.slugify",
"django.db.models.TextField",
"django.db.models.ForeignKey",
"django.utils.timezone.now",
"django.db.models.SlugField",
"django.db.models.DateTimeField",
"django.db.models.CharField"
] | [((175, 271), 'django.db.models.ForeignKey', 'models.ForeignKey', ([], {'to': 'User', 'on_delete': 'models.SET_NULL', 'related_name': '"""feed_posts"""', 'null': '(True)'}), "(to=User, on_delete=models.SET_NULL, related_name=\n 'feed_posts', null=True)\n", (192, 271), False, 'from django.db import models\n'), ((404,... |
#!/usr/bin/env python
from setuptools import setup, find_packages
setup(
name='cellspatialite',
version='1.0.0',
packages=['cellspatialite', 'cellspatialite.test'],
author='Mathieu',
description='cellspatialite',
install_requires= ['pysqlite', 'pandas', 'docopt'],
license='MIT',
entry_... | [
"setuptools.setup"
] | [((68, 387), 'setuptools.setup', 'setup', ([], {'name': '"""cellspatialite"""', 'version': '"""1.0.0"""', 'packages': "['cellspatialite', 'cellspatialite.test']", 'author': '"""Mathieu"""', 'description': '"""cellspatialite"""', 'install_requires': "['pysqlite', 'pandas', 'docopt']", 'license': '"""MIT"""', 'entry_poin... |
import os
import sys
import glob
import tensorflow as tf
import keras
from keras.datasets import mnist
from keras.layers import Dense, Flatten, Dropout
from keras.layers import Conv2D, MaxPooling2D
from keras.models import Sequential
from keras.models import Model
from keras.layers import Dense, GlobalAveragePooling2D,... | [
"keras.optimizers.Adam",
"keras.layers.Conv2D",
"keras.layers.Flatten",
"keras.layers.MaxPooling2D",
"keras.backend.set_session",
"matplotlib.pylab.xlabel",
"keras.callbacks.TensorBoard",
"keras.models.Sequential",
"keras.layers.Dropout",
"load_data.load_data",
"matplotlib.pylab.show",
"keras.... | [((502, 591), 'keras.callbacks.TensorBoard', 'TensorBoard', ([], {'log_dir': '"""./logs"""', 'histogram_freq': '(0)', 'write_graph': '(True)', 'write_images': '(False)'}), "(log_dir='./logs', histogram_freq=0, write_graph=True,\n write_images=False)\n", (513, 591), False, 'from keras.callbacks import TensorBoard\n')... |
#!/usr/bin/env python3
#encoding=utf-8
#------------------------------------------------------
# Usage: python3 use_module2.py
# Description: module basic
#------------------------------------------------------
import module2
print(module2.sys)
print(module2.name)
print(module2.klass)
print('The dict of module2 ... | [
"module2.__dict__.keys"
] | [((338, 361), 'module2.__dict__.keys', 'module2.__dict__.keys', ([], {}), '()\n', (359, 361), False, 'import module2\n'), ((433, 456), 'module2.__dict__.keys', 'module2.__dict__.keys', ([], {}), '()\n', (454, 456), False, 'import module2\n')] |
#!/usr/bin/env python
from __future__ import with_statement
from __future__ import print_function
import sys
import os
import Cookie
import cgi
import common
import cgitb
cgitb.enable()
EMAIL_VARNAME = 'openid.ext1.value.email'
# Are we using basic auth?
auth_type, email = common.web.get_auth_type()
if auth_type ==... | [
"cgi.FieldStorage",
"sys.exit",
"Cookie.Cookie",
"Cookie.SmartCookie",
"common.web.get_auth_type",
"common.UserDatabase",
"common.SessionDatabase",
"cgitb.enable",
"common.print_http_header"
] | [((172, 186), 'cgitb.enable', 'cgitb.enable', ([], {}), '()\n', (184, 186), False, 'import cgitb\n'), ((277, 303), 'common.web.get_auth_type', 'common.web.get_auth_type', ([], {}), '()\n', (301, 303), False, 'import common\n'), ((762, 783), 'common.UserDatabase', 'common.UserDatabase', ([], {}), '()\n', (781, 783), Fal... |
"""utilities for watching worker pools"""
from collections.abc import Callable, Mapping
import logging
import time
from types import MappingProxyType
from typing import Optional, TYPE_CHECKING, Union
if TYPE_CHECKING:
from multiprocessing import Pool
from pathos.multiprocessing import ProcessPool
class Chang... | [
"types.MappingProxyType",
"logging.getLogger",
"time.sleep"
] | [((394, 419), 'types.MappingProxyType', 'MappingProxyType', (['mapping'], {}), '(mapping)\n', (410, 419), False, 'from types import MappingProxyType\n'), ((754, 781), 'types.MappingProxyType', 'MappingProxyType', (['new_state'], {}), '(new_state)\n', (770, 781), False, 'from types import MappingProxyType\n'), ((1381, 1... |
#!/usr/bin/env python3
"""Defines a :class:`Request`."""
import enum
import numbers
from schedsi.cpu import context
Type = enum.Enum('Type', ['current_time', 'resume_chain', 'idle', 'execute', 'timer'])
class Request:
"""A request to the CPU."""
def __init__(self, rtype, arg):
"""Create a :class:`R... | [
"enum.Enum"
] | [((125, 204), 'enum.Enum', 'enum.Enum', (['"""Type"""', "['current_time', 'resume_chain', 'idle', 'execute', 'timer']"], {}), "('Type', ['current_time', 'resume_chain', 'idle', 'execute', 'timer'])\n", (134, 204), False, 'import enum\n')] |
import os
import sys
import tempfile
import subprocess
import cv2
import pymesh
import numpy as np
import torch
import triangle as tr
from tridepth import BaseMesh
from tridepth.extractor import calculate_canny_edges
from tridepth.extractor import SVGReader
from tridepth.extractor import resolve_self_intersection, cle... | [
"pymesh.wires.WireNetwork.create_empty",
"pymesh.wires.WireNetwork.create_from_data",
"triangle.triangulate",
"tridepth.BaseMesh",
"sys.exit",
"subprocess.Popen",
"tridepth.extractor.calculate_canny_edges",
"matplotlib.pyplot.plot",
"os.unlink",
"numpy.concatenate",
"tempfile.NamedTemporaryFile"... | [((1252, 1325), 'subprocess.Popen', 'subprocess.Popen', (['(self.autotrace_cmd + [filename])'], {'stdout': 'subprocess.PIPE'}), '(self.autotrace_cmd + [filename], stdout=subprocess.PIPE)\n', (1268, 1325), False, 'import subprocess\n'), ((2094, 2115), 'tridepth.extractor.SVGReader', 'SVGReader', (['svg_string'], {}), '(... |
"""initial_migration
Revision ID: 476b167aef80
Revises:
Create Date: 2019-01-03 17:03:37.684091
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '<KEY>'
down_revision = None
branch_labels = None
depends_on = None
def upgrade():
op.create_table('user',
... | [
"sqlalchemy.ForeignKeyConstraint",
"sqlalchemy.DateTime",
"alembic.op.drop_table",
"sqlalchemy.PrimaryKeyConstraint",
"sqlalchemy.Integer",
"sqlalchemy.UniqueConstraint",
"sqlalchemy.String"
] | [((1135, 1156), 'alembic.op.drop_table', 'op.drop_table', (['"""page"""'], {}), "('page')\n", (1148, 1156), False, 'from alembic import op\n'), ((1161, 1182), 'alembic.op.drop_table', 'op.drop_table', (['"""user"""'], {}), "('user')\n", (1174, 1182), False, 'from alembic import op\n'), ((615, 644), 'sqlalchemy.PrimaryK... |
"""
## Minería de textos
Universidad de Alicante, curso 2021-2022
Esta documentación forma parte de la práctica "[Lectura y documentación de un sistema de
extracción de entidades](https://jaspock.github.io/mtextos2122/bloque2_practica.html)" y se
basa en el código del curso [CS230](https://github.com/cs230-stanford/c... | [
"torch.nn.LSTM",
"numpy.argmax",
"numpy.sum",
"torch.sum",
"torch.nn.functional.log_softmax",
"torch.nn.Linear",
"torch.nn.Embedding"
] | [((6365, 6391), 'numpy.argmax', 'np.argmax', (['outputs'], {'axis': '(1)'}), '(outputs, axis=1)\n', (6374, 6391), True, 'import numpy as np\n'), ((1609, 1662), 'torch.nn.Embedding', 'nn.Embedding', (['params.vocab_size', 'params.embedding_dim'], {}), '(params.vocab_size, params.embedding_dim)\n', (1621, 1662), True, 'i... |
import pytest
from flask import Flask
from todo import db as _db
@pytest.fixture
def test_app():
"""Set up test Flask application."""
# Set up Flask app
app = Flask(__name__)
# We will create database in memory
# That way, we don't worry about after cleaning/removing it after running tests
ap... | [
"todo.db.drop_all",
"todo.db.init_app",
"todo.db.create_all",
"flask.Flask"
] | [((174, 189), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (179, 189), False, 'from flask import Flask\n'), ((473, 490), 'todo.db.init_app', '_db.init_app', (['app'], {}), '(app)\n', (485, 490), True, 'from todo import db as _db\n'), ((561, 577), 'todo.db.create_all', '_db.create_all', ([], {}), '()\n', ... |
#!/usr/bin/python
from __future__ import print_function
import argparse
import json
import os
import sys
from cli.settings import Settings
import contextlib
@contextlib.contextmanager
def chdir(dirname):
'''Withable chdir function that restores directory'''
curdir = os.getcwd()
try:
os.chdir(dir... | [
"os.makedirs",
"json.dumps",
"os.getcwd",
"os.chdir",
"os.path.abspath",
"cli.settings.Settings"
] | [((279, 290), 'os.getcwd', 'os.getcwd', ([], {}), '()\n', (288, 290), False, 'import os\n'), ((5801, 5811), 'cli.settings.Settings', 'Settings', ([], {}), '()\n', (5809, 5811), False, 'from cli.settings import Settings\n'), ((308, 325), 'os.chdir', 'os.chdir', (['dirname'], {}), '(dirname)\n', (316, 325), False, 'impor... |
import unittest
from records_mover.records.targets.spectrum import SpectrumRecordsTarget
from records_mover.records.existing_table_handling import ExistingTableHandling
from mock import Mock, patch, MagicMock
class TestSpectrum(unittest.TestCase):
@patch('records_mover.records.targets.spectrum.ParquetRecordsForma... | [
"mock.Mock",
"mock.patch",
"mock.MagicMock",
"records_mover.records.targets.spectrum.SpectrumRecordsTarget"
] | [((255, 323), 'mock.patch', 'patch', (['"""records_mover.records.targets.spectrum.ParquetRecordsFormat"""'], {}), "('records_mover.records.targets.spectrum.ParquetRecordsFormat')\n", (260, 323), False, 'from mock import Mock, patch, MagicMock\n'), ((1992, 2062), 'mock.patch', 'patch', (['"""records_mover.records.target... |
# Generated by Django 3.0.11 on 2020-12-09 06:05
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('telephone_directory', '0002_auto_20201208_1801'),
]
operations = [
migrations.AddField(
model_name='contacts',
name... | [
"django.db.models.ImageField"
] | [((354, 420), 'django.db.models.ImageField', 'models.ImageField', ([], {'blank': '(True)', 'null': '(True)', 'upload_to': '"""profile_pic/"""'}), "(blank=True, null=True, upload_to='profile_pic/')\n", (371, 420), False, 'from django.db import migrations, models\n')] |
import arcpy, os
FC_Frontage_Roads = arcpy.GetParameterAsText(0)
FC_Centerlines = arcpy.GetParameterAsText(1)
Routed_SubFiles = arcpy.GetParameterAsText(2)
District_Boundaries = arcpy.GetParameterAsText(3)
MPO_Boundaries = arcpy.GetParameterAsText(4)
outputFolder = arcpy.GetParameterAsText(5)
scracthSpace = outputFolde... | [
"os.path.exists",
"arcpy.CalculateField_management",
"arcpy.Dissolve_management",
"arcpy.Merge_management",
"arcpy.Erase_analysis",
"arcpy.AddMessage",
"arcpy.AddField_management",
"os.makedirs",
"arcpy.SetProgressorPosition",
"arcpy.SetProgressorLabel",
"arcpy.Intersect_analysis",
"arcpy.GetP... | [((37, 64), 'arcpy.GetParameterAsText', 'arcpy.GetParameterAsText', (['(0)'], {}), '(0)\n', (61, 64), False, 'import arcpy, os\n'), ((82, 109), 'arcpy.GetParameterAsText', 'arcpy.GetParameterAsText', (['(1)'], {}), '(1)\n', (106, 109), False, 'import arcpy, os\n'), ((128, 155), 'arcpy.GetParameterAsText', 'arcpy.GetPar... |
"""pah_fm URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/2.1/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: path('', views.home, name='home')
Class-based ... | [
"fleet_management.api.ProjectView.as_view",
"fleet_management.api.PassengerListView.as_view",
"fleet_management.api.RefuelView.as_view",
"fleet_management.api.DriveView.as_view",
"fleet_management.api.CurrentUserRetrieveView.as_view",
"django.conf.urls.static.static",
"rest_framework.documentation.inclu... | [((1640, 1703), 'django.conf.urls.static.static', 'static', (['settings.STATIC_URL'], {'document_root': 'settings.STATIC_ROOT'}), '(settings.STATIC_URL, document_root=settings.STATIC_ROOT)\n', (1646, 1703), False, 'from django.conf.urls.static import static\n'), ((1055, 1086), 'django.urls.path', 'path', (['"""admin/""... |