code stringlengths 20 1.04M | apis list | extract_api stringlengths 75 9.94M |
|---|---|---|
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: steammessages_store.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 import reflecti... | [
"google.protobuf.descriptor.FieldDescriptor",
"google.protobuf.descriptor_pb2.ServiceOptions",
"google.protobuf.symbol_database.Default",
"google.protobuf.descriptor_pb2.MethodOptions",
"google.protobuf.descriptor_pb2.FileOptions"
] | [((587, 613), 'google.protobuf.symbol_database.Default', '_symbol_database.Default', ([], {}), '()\n', (611, 613), True, 'from google.protobuf import symbol_database as _symbol_database\n'), ((6936, 6964), 'google.protobuf.descriptor_pb2.FileOptions', 'descriptor_pb2.FileOptions', ([], {}), '()\n', (6962, 6964), False,... |
# Generated by Django 3.0.5 on 2020-04-16 17:28
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='CrawlerQueueElement',
fiel... | [
"django.db.models.TextField",
"django.db.models.URLField",
"django.db.models.ForeignKey",
"django.db.models.CharField",
"django.db.models.BooleanField",
"django.db.models.AutoField",
"django.db.models.IntegerField",
"django.db.models.DateField",
"django.db.models.DateTimeField"
] | [((2281, 2374), 'django.db.models.ForeignKey', 'models.ForeignKey', ([], {'on_delete': 'django.db.models.deletion.CASCADE', 'to': '"""webfrontent.Website"""'}), "(on_delete=django.db.models.deletion.CASCADE, to=\n 'webfrontent.Website')\n", (2298, 2374), False, 'from django.db import migrations, models\n'), ((348, 4... |
from setuptools import setup
_classifiers = [
"License :: OSI Approved :: MIT License",
"Operating System :: OS Independent",
"Programming Language :: Python :: 3.5",
]
with open("README.md") as file:
_long_description = file.read()
setup(
author="<NAME>",
classifiers=_classifiers,
descri... | [
"setuptools.setup"
] | [((252, 624), 'setuptools.setup', 'setup', ([], {'author': '"""<NAME>"""', 'classifiers': '_classifiers', 'description': '"""Chunked transfer encoding as defined in RFC 7230"""', 'long_description': '_long_description', 'long_description_content_type': '"""text/markdown"""', 'license': '"""MIT"""', 'name': '"""httpchun... |
# -*- coding: utf-8 -*-
import hashlib
import random
md5 = hashlib.md5()
md5.update('how to use md5 in python hashlib?'.encode('utf-8'))
print(md5.hexdigest())
sha1 = hashlib.sha1()
sha1.update('how to use sha1 in '.encode('utf-8'))
sha1.update('python hashlib?'.encode('utf-8'))
print(sha1.hexdigest())
# 设计一个验证用户登... | [
"hashlib.md5",
"hashlib.sha1"
] | [((60, 73), 'hashlib.md5', 'hashlib.md5', ([], {}), '()\n', (71, 73), False, 'import hashlib\n'), ((170, 184), 'hashlib.sha1', 'hashlib.sha1', ([], {}), '()\n', (182, 184), False, 'import hashlib\n'), ((478, 491), 'hashlib.md5', 'hashlib.md5', ([], {}), '()\n', (489, 491), False, 'import hashlib\n'), ((633, 647), 'hash... |
import scipy
from scipy import stats
import numpy as np
from math import sqrt
from itertools import product
def closest_point_on_segment(p, a, b):
lsqr = (a[0]-b[0])**2 + (a[1]-b[1])**2
pa = p-a
ba = b-a
if (lsqr < 1e-15):
return a
t_opt = pa.dot(ba) / lsqr
t_opt = max(min(t_opt, 1), ... | [
"numpy.array",
"numpy.linalg.norm"
] | [((459, 481), 'numpy.linalg.norm', 'np.linalg.norm', (['(cp - p)'], {}), '(cp - p)\n', (473, 481), True, 'import numpy as np\n'), ((625, 655), 'numpy.array', 'np.array', (['[wa / 2.0, ha / 2.0]'], {}), '([wa / 2.0, ha / 2.0])\n', (633, 655), True, 'import numpy as np\n'), ((666, 697), 'numpy.array', 'np.array', (['[wa ... |
from django.db import models
class TestRealm(models.Model):
slug = models.CharField(max_length=16)
def get_absolute_url(self):
return ''
def generate(self):
pass
class TestAgent(models.Model):
realm = models.ForeignKey(TestRealm, on_delete=models.SET_NULL, related_name='agents', nu... | [
"django.db.models.CharField",
"django.db.models.ForeignKey"
] | [((73, 104), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(16)'}), '(max_length=16)\n', (89, 104), False, 'from django.db import models\n'), ((239, 333), 'django.db.models.ForeignKey', 'models.ForeignKey', (['TestRealm'], {'on_delete': 'models.SET_NULL', 'related_name': '"""agents"""', 'null':... |
# Copyright 2016 ZTE Corporation.
#
# 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 ... | [
"lcm.pub.nfvi.vim.lib.syscomm.fun_name",
"lcm.pub.nfvi.vim.api.multivim.api.MultiVimApi",
"traceback.format_exc",
"sys.exc_info",
"logging.getLogger"
] | [((787, 814), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (804, 814), False, 'import logging\n'), ((1350, 1363), 'lcm.pub.nfvi.vim.api.multivim.api.MultiVimApi', 'MultiVimApi', ([], {}), '()\n', (1361, 1363), False, 'from lcm.pub.nfvi.vim.api.multivim.api import MultiVimApi\n'), ((3012... |
import datetime
import enum
import random
from collections import namedtuple
from itertools import islice, starmap
from typing import Any, Dict, Generator, Iterator, Tuple
import pandas as pd
from faker import Faker
class Columns(enum.Enum):
"""Available columns for data generator
NAME[str]: First + Last + ... | [
"faker.Faker",
"random.choice",
"random.random",
"collections.namedtuple",
"itertools.islice"
] | [((1389, 1405), 'faker.Faker', 'Faker', ([], {'seed': 'seed'}), '(seed=seed)\n', (1394, 1405), False, 'from faker import Faker\n'), ((4878, 4909), 'collections.namedtuple', 'namedtuple', (['"""Row"""', 'self.headers'], {}), "('Row', self.headers)\n", (4888, 4909), False, 'from collections import namedtuple\n'), ((5131,... |
from rest_framework import serializers
from .models import UserProfile, ProfileFeedItem
class HelloSerializer(serializers.Serializer):
''' Serializes a name field for testing the APIView '''
name = serializers.CharField(max_length=10)
class UserProfileSerializer(serializers.ModelSerializer):
''' Seriali... | [
"rest_framework.serializers.CharField"
] | [((208, 244), 'rest_framework.serializers.CharField', 'serializers.CharField', ([], {'max_length': '(10)'}), '(max_length=10)\n', (229, 244), False, 'from rest_framework import serializers\n')] |
import os
os.system("cat /etc/passwd") | [
"os.system"
] | [((11, 39), 'os.system', 'os.system', (['"""cat /etc/passwd"""'], {}), "('cat /etc/passwd')\n", (20, 39), False, 'import os\n')] |
from app import app, command_system
from app.scheduledb import ScheduleDB
import re
import difflib
def auto_posting_on(uid, key, arg=""):
# Если пользователя нет в базе, то ему выведет предложение зарегистрироваться
try:
with ScheduleDB(app.config) as db:
user = db.find_user(uid)
... | [
"re.split",
"re.match",
"difflib.SequenceMatcher",
"app.command_system.Command",
"app.scheduledb.ScheduleDB"
] | [((2469, 2493), 'app.command_system.Command', 'command_system.Command', ([], {}), '()\n', (2491, 2493), False, 'from app import app, command_system\n'), ((924, 957), 're.match', 're.match', (['time', '"""\\\\d{1,2}:\\\\d\\\\d"""'], {}), "(time, '\\\\d{1,2}:\\\\d\\\\d')\n", (932, 957), False, 'import re\n'), ((245, 267)... |
# importing Libraries
import cv2
from google.colab.patches import cv2_imshow
import dlib
from scipy.spatial import distance
from headpose import PoseEstimator
from gaze_tracking import GazeTracking
import time
import math
# Eye Aspect Ratio
# defining Functions
def calculate_EAR(eye):
A = distance.euclidean(eye[... | [
"cv2.line",
"scipy.spatial.distance.euclidean",
"cv2.cvtColor",
"dlib.get_frontal_face_detector",
"dlib.shape_predictor"
] | [((492, 524), 'dlib.get_frontal_face_detector', 'dlib.get_frontal_face_detector', ([], {}), '()\n', (522, 524), False, 'import dlib\n'), ((605, 634), 'dlib.shape_predictor', 'dlib.shape_predictor', (['datFile'], {}), '(datFile)\n', (625, 634), False, 'import dlib\n'), ((297, 331), 'scipy.spatial.distance.euclidean', 'd... |
from nose.tools import eq_
from moban.filters.repr import repr as repr_function
def test_string():
me = "abc"
expected = repr_function(me)
eq_(expected, "'abc'")
def test_list():
me = [1, 2, 3]
expected = repr_function(me)
eq_(expected, ["'1'", "'2'", "'3'"])
| [
"nose.tools.eq_",
"moban.filters.repr.repr"
] | [((131, 148), 'moban.filters.repr.repr', 'repr_function', (['me'], {}), '(me)\n', (144, 148), True, 'from moban.filters.repr import repr as repr_function\n'), ((153, 175), 'nose.tools.eq_', 'eq_', (['expected', '"""\'abc\'"""'], {}), '(expected, "\'abc\'")\n', (156, 175), False, 'from nose.tools import eq_\n'), ((229, ... |
import requests
import json
import yaml
def search(text):
words = "+".join(text.split())
url = f"https://www.youtube.com/results?search_query={words}&sp=EgIQAQ%253D%253D"
response = requests.get(url)
response_json = get_json(response.text)
write_json("response", response_json)
videos = get_vide... | [
"yaml.load",
"requests.get",
"json.dumps"
] | [((195, 212), 'requests.get', 'requests.get', (['url'], {}), '(url)\n', (207, 212), False, 'import requests\n'), ((756, 800), 'yaml.load', 'yaml.load', (['json_text'], {'Loader': 'yaml.FullLoader'}), '(json_text, Loader=yaml.FullLoader)\n', (765, 800), False, 'import yaml\n'), ((1773, 1799), 'json.dumps', 'json.dumps',... |
#! /usr/bin/env python3
import select
import argparse
import platform
import os
import contextlib
import subprocess
system = platform.system()
if not (system == "Darwin" or "BSD" in system):
print("WARN: It requires kqueue.")
@contextlib.contextmanager
def close(xs):
try:
yield xs
finally:
... | [
"subprocess.run",
"select.kqueue",
"argparse.ArgumentParser",
"select.kevent",
"os.path.exists",
"platform.system"
] | [((126, 143), 'platform.system', 'platform.system', ([], {}), '()\n', (141, 143), False, 'import platform\n'), ((719, 787), 'argparse.ArgumentParser', 'argparse.ArgumentParser', (['"""Watch for files changes and run a command"""'], {}), "('Watch for files changes and run a command')\n", (742, 787), False, 'import argpa... |
from datetime import datetime
import pytz
def convert_date(str_date: str) -> datetime:
date = datetime.strptime(str_date.strip(), '%Y-%m-%d %H:%M:%S')
return pytz.utc.localize(date)
def normalize_email(email: str) -> str:
from colossus.apps.subscribers.models import Subscriber
return Subscriber.obj... | [
"colossus.apps.subscribers.models.Subscriber.objects.normalize_email",
"pytz.utc.localize"
] | [((169, 192), 'pytz.utc.localize', 'pytz.utc.localize', (['date'], {}), '(date)\n', (186, 192), False, 'import pytz\n'), ((306, 347), 'colossus.apps.subscribers.models.Subscriber.objects.normalize_email', 'Subscriber.objects.normalize_email', (['email'], {}), '(email)\n', (340, 347), False, 'from colossus.apps.subscrib... |
#!/usr/bin/env python
import optparse
from Trojan import *
parser = optparse.OptionParser()
parser.add_option('-f', '--front-file', dest='front_file_url', help='Direct URL to file that the user will see.')
parser.add_option('-e', '--evil-file', dest='evil_file_url', help='Direct URL to the evil file file.')
parser.a... | [
"optparse.OptionParser"
] | [((71, 94), 'optparse.OptionParser', 'optparse.OptionParser', ([], {}), '()\n', (92, 94), False, 'import optparse\n')] |
import os
import os.path
from os import path
import re
def main():
l = os.getcwd()
a = [x[0] for x in os.walk(l)]
count = 1
for dir in a:
if not re.search("git", dir) and dir != "." and not re.search("vscode", dir) and dir != l:
p = os.path.join(l, os.path.join(dir, "README.md"))
... | [
"os.path.join",
"os.getcwd",
"os.walk",
"os.path.isfile",
"re.search"
] | [((77, 88), 'os.getcwd', 'os.getcwd', ([], {}), '()\n', (86, 88), False, 'import os\n'), ((112, 122), 'os.walk', 'os.walk', (['l'], {}), '(l)\n', (119, 122), False, 'import os\n'), ((392, 406), 'os.path.isfile', 'path.isfile', (['p'], {}), '(p)\n', (403, 406), False, 'from os import path\n'), ((171, 192), 're.search', ... |
# from PySide2.QtCore import QDateTime, Qt
from PySide2.QtGui import QPainter
from PySide2.QtWidgets import (QHBoxLayout,
QHeaderView,
QSizePolicy,
QTableView,
QWidget)
from PySide2.QtCharts impo... | [
"lesson_07_CustomTableModel.CustomTableModel",
"PySide2.QtCharts.QtCharts.QChart",
"PySide2.QtWidgets.QWidget.__init__",
"PySide2.QtCharts.QtCharts.QChartView",
"PySide2.QtWidgets.QTableView",
"PySide2.QtWidgets.QSizePolicy",
"PySide2.QtWidgets.QHBoxLayout"
] | [((452, 474), 'PySide2.QtWidgets.QWidget.__init__', 'QWidget.__init__', (['self'], {}), '(self)\n', (468, 474), False, 'from PySide2.QtWidgets import QHBoxLayout, QHeaderView, QSizePolicy, QTableView, QWidget\n'), ((525, 547), 'lesson_07_CustomTableModel.CustomTableModel', 'CustomTableModel', (['data'], {}), '(data)\n'... |
'''
by <NAME>
Library for common functions used by an rtl-sdr based radio telescope.
'''
import os
import subprocess
def biast(state, index=0):
'''
Turn the bias tee on the device on or off.
You should configure the path here to call the rtl_biast
executable on your machine.
Inputs:
state (... | [
"subprocess.run",
"os.path.expanduser",
"os.path.join"
] | [((681, 712), 'os.path.expanduser', 'os.path.expanduser', (['"""~/github/"""'], {}), "('~/github/')\n", (699, 712), False, 'import os\n'), ((850, 919), 'subprocess.run', 'subprocess.run', (['cmd'], {'stdout': 'subprocess.PIPE', 'stderr': 'subprocess.STDOUT'}), '(cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)\n'... |
from django.contrib import messages
from django.shortcuts import render, get_object_or_404, redirect
from .models import Project
from .forms import ProjectForm
def project_list(request, template='projects/project_list.html'):
project_list = Project.objects.order_by('project_name')
if request.method == 'GET... | [
"django.shortcuts.render",
"django.shortcuts.get_object_or_404",
"django.contrib.messages.success",
"django.shortcuts.redirect"
] | [((730, 764), 'django.shortcuts.render', 'render', (['request', 'template', 'context'], {}), '(request, template, context)\n', (736, 764), False, 'from django.shortcuts import render, get_object_or_404, redirect\n'), ((821, 862), 'django.shortcuts.get_object_or_404', 'get_object_or_404', (['Project'], {'pk': 'project_i... |
from openapi_specgen import OpenApiParam, OpenApiPath, OpenApiResponse
from .utils import MarshmallowSchema
def test_path_with_params():
expected_openapi_dict = {
'/test_path': {
'get': {
'description': 'Test Description',
'summary': 'Test Summary',
... | [
"openapi_specgen.OpenApiParam",
"openapi_specgen.OpenApiResponse"
] | [((1040, 1072), 'openapi_specgen.OpenApiResponse', 'OpenApiResponse', (['"""Test Response"""'], {}), "('Test Response')\n", (1055, 1072), False, 'from openapi_specgen import OpenApiParam, OpenApiPath, OpenApiResponse\n'), ((1107, 1147), 'openapi_specgen.OpenApiParam', 'OpenApiParam', (['"""test_param"""', '"""query"""'... |
import unittest
import zeit.cms.testing
def test_suite():
suite = unittest.TestSuite()
suite.addTest(zeit.cms.testing.FunctionalDocFileSuite(
'indicator.txt'))
return suite
| [
"unittest.TestSuite"
] | [((73, 93), 'unittest.TestSuite', 'unittest.TestSuite', ([], {}), '()\n', (91, 93), False, 'import unittest\n')] |
# Generated by Django 3.1.5 on 2021-01-27 23:20
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('main', '0007_auto_20201127_2042'),
]
operations = [
migrations.AddField(
model_name='video',
name='bit_depth_recomme... | [
"django.db.models.CharField"
] | [((345, 418), 'django.db.models.CharField', 'models.CharField', ([], {'blank': '(True)', 'default': '"""Unknown"""', 'max_length': '(64)', 'null': '(True)'}), "(blank=True, default='Unknown', max_length=64, null=True)\n", (361, 418), False, 'from django.db import migrations, models\n'), ((656, 729), 'django.db.models.C... |
from hail.utils.java import Env
def encode(expression, codec='{"name":"BlockingBufferSpec","blockSize":65536,"child":{"name":"StreamBlockBufferSpec"}}'):
v = Env.spark_backend('encode')._jbackend.encodeToBytes(Env.backend()._to_java_value_ir(expression._ir), codec)
return (v._1(), v._2())
def decode(typ, pt... | [
"hail.utils.java.Env.backend",
"hail.utils.java.Env.spark_backend"
] | [((164, 191), 'hail.utils.java.Env.spark_backend', 'Env.spark_backend', (['"""encode"""'], {}), "('encode')\n", (181, 191), False, 'from hail.utils.java import Env\n'), ((216, 229), 'hail.utils.java.Env.backend', 'Env.backend', ([], {}), '()\n', (227, 229), False, 'from hail.utils.java import Env\n'), ((473, 500), 'hai... |
# Copyright 2014 OpenStack Foundation
# 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 requ... | [
"tempest.openstack.common.jsonutils.dumps",
"urllib.urlencode"
] | [((1265, 1281), 'tempest.openstack.common.jsonutils.dumps', 'json.dumps', (['body'], {}), '(body)\n', (1275, 1281), True, 'from tempest.openstack.common import jsonutils as json\n'), ((2348, 2374), 'urllib.urlencode', 'urllib.urlencode', (['uri_dict'], {}), '(uri_dict)\n', (2364, 2374), False, 'import urllib\n')] |
# Copyright (c) 2017-present, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the license found in the LICENSE file in
# the root directory of this source tree. An additional grant of patent rights
# can be found in the PATENTS file in the same directory.
import numpy
from . import Fairseq... | [
"numpy.power"
] | [((2499, 2538), 'numpy.power', 'numpy.power', (['self.noam_model_size', '(-0.5)'], {}), '(self.noam_model_size, -0.5)\n', (2510, 2538), False, 'import numpy\n'), ((2368, 2398), 'numpy.power', 'numpy.power', (['num_updates', '(-0.5)'], {}), '(num_updates, -0.5)\n', (2379, 2398), False, 'import numpy\n'), ((2427, 2465), ... |
import torch.utils.data as data
import pandas as pd
import numpy as np
from PIL import Image
import os.path
import torchvision.transforms as transforms
import torch
from random import shuffle
class CelebA_Dataloader(data.DataLoader):
def __init__(self, csv_path, images_path, targets, batch_size, num_workers,
... | [
"pandas.read_csv",
"random.shuffle",
"PIL.Image.open",
"numpy.array",
"pandas.set_option",
"torchvision.transforms.Resize"
] | [((1159, 1180), 'pandas.read_csv', 'pd.read_csv', (['csv_path'], {}), '(csv_path)\n', (1170, 1180), True, 'import pandas as pd\n'), ((1670, 1716), 'pandas.set_option', 'pd.set_option', (['"""mode.chained_assignment"""', 'None'], {}), "('mode.chained_assignment', None)\n", (1683, 1716), True, 'import pandas as pd\n'), (... |
# # -*- coding: utf-8 -*-
# # @Time : 20-6-9 下午3:06
# # @Author : zhuying
# # @Company : Minivision
# # @File : test.py
# # @Software : PyCharm
import os
import cv2
import numpy as np
import argparse
import warnings
import time
import shutil
from src.anti_spoof_predict import AntiSpoofPredict
from src.generate_patche... | [
"src.anti_spoof_predict.AntiSpoofPredict",
"argparse.ArgumentParser",
"src.default_config.get_default_config",
"warnings.filterwarnings",
"numpy.argmax",
"numpy.zeros",
"time.time",
"cv2.imread",
"src.generate_patches.CropImage",
"src.utility.parse_model_name",
"os.path.join",
"os.listdir"
] | [((430, 463), 'warnings.filterwarnings', 'warnings.filterwarnings', (['"""ignore"""'], {}), "('ignore')\n", (453, 463), False, 'import warnings\n'), ((641, 661), 'src.default_config.get_default_config', 'get_default_config', ([], {}), '()\n', (659, 661), False, 'from src.default_config import get_default_config\n'), ((... |
"""
파이선 PIL 라이브러리 테스팅
저자 : 안광은 (<EMAIL>)
버전 : python 3.5.4, PyQt 5.9.0
PIL 라이브러리 테스팅! 참고하고 있는 Tensorflow 소스코드가 이미지 읽을 때 PIL라이브러리를 자주 불러오기에 설치하면서 간단히 기능을 테스트 해봤습니다~!
PIL을 사용하기 위해서 Pillow 패키지를 설치해야됩니닷!
pip install Pillow
레퍼런스:
http://pythonstudy.xyz/python/article/406-%ED%8C%8C%EC%9D%B4%EC%8D%AC-%EC%9D%B4%EB%AF%B8%EC%... | [
"PIL.Image.open"
] | [((744, 773), 'PIL.Image.open', 'Image.open', (['IMAGE_PATH_IN_PNG'], {}), '(IMAGE_PATH_IN_PNG)\n', (754, 773), False, 'from PIL import Image\n'), ((784, 814), 'PIL.Image.open', 'Image.open', (['IMAGE_PATH_IN_JPEG'], {}), '(IMAGE_PATH_IN_JPEG)\n', (794, 814), False, 'from PIL import Image\n')] |
import datetime
import json
import os
import re
import socket
import sys
from xml.etree import ElementTree
import requests
from requests.exceptions import RequestException
import yaml
from smoketest.loggers import get_logger
from smoketest.platforms import get_platforms_from_element
from smoketest.settings import (
... | [
"smoketest.utils.transform_url",
"smoketest.loggers.get_logger",
"yaml.safe_load",
"smoketest.platforms.get_platforms_from_element",
"requests.Session",
"os.path.dirname",
"smoketest.utils.transform_url_based_on_options",
"smoketest.tests.get_tests_from_element",
"datetime.timedelta",
"sys.stderr.... | [((2277, 2295), 'requests.Session', 'requests.Session', ([], {}), '()\n', (2293, 2295), False, 'import requests\n'), ((1161, 1205), 'smoketest.utils.transform_url_based_on_options', 'transform_url_based_on_options', (['url', 'options'], {}), '(url, options)\n', (1191, 1205), False, 'from smoketest.utils import transfor... |
from django.db import models
from core.models import Universe
class Player(models.Model):
def __unicode__(self):
return self.last_name + ', ' + self.first_name
POSITIONS = (
('QB', 'Quarterback'),
('RB', 'Running Back'),
('WR', 'Wide Receiver'),
('OT', 'Of... | [
"django.db.models.ForeignKey",
"django.db.models.IntegerField",
"django.db.models.CharField",
"django.db.models.BooleanField"
] | [((629, 688), 'django.db.models.ForeignKey', 'models.ForeignKey', (['Universe'], {'related_name': '"""player_universe"""'}), "(Universe, related_name='player_universe')\n", (646, 688), False, 'from django.db import models\n'), ((702, 736), 'django.db.models.BooleanField', 'models.BooleanField', ([], {'default': '(False... |
"""<NAME>: GitHub project
"""
import libLF.lf_ndjson as lf_ndjson
import libLF
import json
import re
import os
import tempfile
import subprocess
import time
class SimpleGitHubProjectNameAndStars:
"""GitHub project name with # stars
name: projectOwner/repoName
nStars: integer
"""
Type = 'SimpleGitHubPro... | [
"subprocess.run",
"libLF.logLang2SourceFiles",
"json.load",
"os.unlink",
"tempfile.mkstemp",
"libLF.log",
"time.sleep",
"libLF.GitHubProject",
"os.path.isfile",
"os.path.islink",
"os.close",
"libLF.pathSplitAll",
"libLF.lf_ndjson.fromNDJSON"
] | [((7125, 7153), 'libLF.pathSplitAll', 'libLF.pathSplitAll', (['filePath'], {}), '(filePath)\n', (7143, 7153), False, 'import libLF\n'), ((8463, 8511), 'tempfile.mkstemp', 'tempfile.mkstemp', ([], {'suffix': '""".json"""', 'prefix': '"""cloc-"""'}), "(suffix='.json', prefix='cloc-')\n", (8479, 8511), False, 'import temp... |
import scipy as sc
from scipy import linalg as la
import matplotlib
A = sc.array([0,1],[2,1],[2,1])
b = sc.array([1,1,2]) # numy and scipy can figure out themselves if it has to be a column vector
| [
"scipy.array"
] | [((73, 105), 'scipy.array', 'sc.array', (['[0, 1]', '[2, 1]', '[2, 1]'], {}), '([0, 1], [2, 1], [2, 1])\n', (81, 105), True, 'import scipy as sc\n'), ((105, 124), 'scipy.array', 'sc.array', (['[1, 1, 2]'], {}), '([1, 1, 2])\n', (113, 124), True, 'import scipy as sc\n')] |
import argparse
import time
from config import Config
from os import path
from pathlib import Path
from home_server_api_client import HomeServerApiClient
from requests.exceptions import Timeout
import board
import adafruit_dht
default_config_path = path.join(str(Path.home()), ".homeserver_logger_config.json")
def l... | [
"json.load",
"pathlib.Path.home",
"argparse.ArgumentParser",
"adafruit_dht.DHT11",
"config.Config",
"os.path.exists",
"time.sleep",
"home_server_api_client.HomeServerApiClient"
] | [((1321, 1390), 'home_server_api_client.HomeServerApiClient', 'HomeServerApiClient', (['config.endpoint', 'config.sensor_id', 'config.secret'], {}), '(config.endpoint, config.sensor_id, config.secret)\n', (1340, 1390), False, 'from home_server_api_client import HomeServerApiClient\n'), ((1639, 1669), 'adafruit_dht.DHT1... |
# *_*coding:utf-8 *_*
"""
inference
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import logging
import time
import os
from senta.common.rule import InstanceName
from senta.utils import params
from senta.utils.util_helper import array2tensor
from pa... | [
"os.path.dirname",
"paddle.fluid.core_avx.AnalysisConfig",
"senta.utils.params.from_file",
"time.time",
"senta.utils.util_helper.array2tensor",
"logging.info",
"senta.utils.params.replace_none"
] | [((1103, 1174), 'paddle.fluid.core_avx.AnalysisConfig', 'AnalysisConfig', (["(model_path + '/' + 'model')", "(model_path + '/' + 'params')"], {}), "(model_path + '/' + 'model', model_path + '/' + 'params')\n", (1117, 1174), False, 'from paddle.fluid.core_avx import AnalysisConfig, create_paddle_predictor\n'), ((1834, 1... |
from phenoai.factory import create_app
from settings.instance import settings
app = create_app(settings=settings)
| [
"phenoai.factory.create_app"
] | [((85, 114), 'phenoai.factory.create_app', 'create_app', ([], {'settings': 'settings'}), '(settings=settings)\n', (95, 114), False, 'from phenoai.factory import create_app\n')] |
from functools import partial
from typing import Any, Callable, Dict, Optional, Union
import torch
from torch import nn
import torch.nn.functional as F
from torch.optim.lr_scheduler import ReduceLROnPlateau
from collie.model.base import BasePipeline, INTERACTIONS_LIKE_INPUT, ScaledEmbedding, ZeroEmbedding
from collie... | [
"torch.nn.Dropout",
"functools.partial",
"torch.nn.ReLU",
"torch.nn.Sequential",
"torch.sum",
"collie.utils.merge_docstrings",
"collie.model.base.ScaledEmbedding",
"torch.cat",
"torch.sigmoid",
"torch.pow",
"torch.nn.functional.leaky_relu",
"torch.nn.Linear",
"torch.zeros",
"torch.nn.funct... | [((5088, 5137), 'collie.utils.merge_docstrings', 'merge_docstrings', (['BasePipeline', '__doc__', '__init__'], {}), '(BasePipeline, __doc__, __init__)\n', (5104, 5137), False, 'from collie.utils import get_init_arguments, merge_docstrings, trunc_normal\n'), ((4279, 4331), 'functools.partial', 'partial', (['ReduceLROnPl... |
from django import forms
class ExampleForm(forms.Form):
non_blank_field = forms.CharField(max_length=100,
widget=forms.TextInput(attrs={
'placeholder': "Must not be blank!",
}),
)
| [
"django.forms.TextInput"
] | [((127, 187), 'django.forms.TextInput', 'forms.TextInput', ([], {'attrs': "{'placeholder': 'Must not be blank!'}"}), "(attrs={'placeholder': 'Must not be blank!'})\n", (142, 187), False, 'from django import forms\n')] |
from setuptools import setup, find_packages
setup(
name='simeng',
version='0.0.1',
packages=find_packages(include=['simeng', 'simeng.*', 'simeng.data_structs']),
install_requires=[
'pyglet'
]
) | [
"setuptools.find_packages"
] | [((105, 173), 'setuptools.find_packages', 'find_packages', ([], {'include': "['simeng', 'simeng.*', 'simeng.data_structs']"}), "(include=['simeng', 'simeng.*', 'simeng.data_structs'])\n", (118, 173), False, 'from setuptools import setup, find_packages\n')] |
import contextlib
import json
import time
from talon import cron, ctrl, resource, ui
from talon.voice import Context, press
from .. import utils
from . import last_phrase
single_digits = "0123456789"
NAMED_DESKTOPS = {digit: int(digit) for digit in single_digits}
desktops_filename = utils.local_filename(__file__, "n... | [
"talon.voice.Context",
"talon.ctrl.mouse_click",
"talon.ctrl.mouse_move",
"talon.ui.apps",
"talon.ui.active_window",
"time.sleep",
"talon.resource.open",
"talon.cron.after",
"talon.voice.press"
] | [((1697, 1714), 'talon.voice.Context', 'Context', (['"""spaces"""'], {}), "('spaces')\n", (1704, 1714), False, 'from talon.voice import Context, press\n'), ((776, 797), 'talon.ctrl.mouse_move', 'ctrl.mouse_move', (['x', 'y'], {}), '(x, y)\n', (791, 797), False, 'from talon import cron, ctrl, resource, ui\n'), ((802, 83... |
from django import shortcuts
from django.contrib import auth
import django.http
import django.views.decorators.http as http_decorators
from modules.smartq import models
import sistema.staff
@sistema.staff.only_staff
def show_admin_question_instance(request, question_short_name):
base_question = shortcuts.get_obje... | [
"modules.smartq.models.StaffGeneratedQuestion.get_instance",
"django.shortcuts.redirect",
"django.shortcuts.get_object_or_404",
"modules.smartq.models.StaffGeneratedQuestion.regenerate",
"django.shortcuts.render"
] | [((302, 378), 'django.shortcuts.get_object_or_404', 'shortcuts.get_object_or_404', (['models.Question'], {'short_name': 'question_short_name'}), '(models.Question, short_name=question_short_name)\n', (329, 378), False, 'from django import shortcuts\n'), ((453, 524), 'modules.smartq.models.StaffGeneratedQuestion.get_ins... |
import requests
import datetime
import logging
import sqlite3
import asyncio
from communicationApp.utils import get_object_by_keys
from communicationApp.communicationApp import CommunicationApp
import os
TELEGRAM_API = "https://api.telegram.org/bot"
GET_UPDATE = 'getUpdates'
SEND_MESSAGE = 'sendMessage'
SEND_PHOTO= ... | [
"os.mkdir",
"logging.error",
"os.stat",
"logging.basicConfig",
"os.path.dirname",
"communicationApp.utils.get_object_by_keys",
"datetime.date.today",
"sqlite3.connect",
"requests.get",
"requests.post"
] | [((552, 591), 'communicationApp.utils.get_object_by_keys', 'get_object_by_keys', (['kwargs', '"""bot_token"""'], {}), "(kwargs, 'bot_token')\n", (570, 591), False, 'from communicationApp.utils import get_object_by_keys\n'), ((1361, 1390), 'sqlite3.connect', 'sqlite3.connect', (['self.db_name'], {}), '(self.db_name)\n',... |
# Standard library imports.
import logging
# Plugin imports.
from envisage.core_plugin import CorePlugin
from envisage.ui.tasks.tasks_plugin import TasksPlugin
from attractors_plugin import AttractorsPlugin
# Local imports.
from attractors_application import AttractorsApplication
def main(argv):
""" Run the app... | [
"logging.basicConfig",
"attractors_application.AttractorsApplication",
"logging.shutdown",
"envisage.core_plugin.CorePlugin",
"attractors_plugin.AttractorsPlugin",
"envisage.ui.tasks.tasks_plugin.TasksPlugin"
] | [((342, 384), 'logging.basicConfig', 'logging.basicConfig', ([], {'level': 'logging.WARNING'}), '(level=logging.WARNING)\n', (361, 384), False, 'import logging\n'), ((460, 498), 'attractors_application.AttractorsApplication', 'AttractorsApplication', ([], {'plugins': 'plugins'}), '(plugins=plugins)\n', (481, 498), Fals... |
import pygame
import pygame_gui
import random
import glob
from enum import Enum
from collections import namedtuple
from levels import Levels
MUSIC_VOLUME = 0.1
SOUND_VOLUME = 0.2
BLOCK_SIZE = 10
SPEED = 20
MAP_WIDTH = 640
MAP_HEIGHT = 480
pygame.mixer.pre_init(44100, -16, 2, 512)
pygame.mixer.init()
pygame.init()
# ... | [
"pygame.event.get",
"pygame.mixer.init",
"pygame.Rect",
"pygame.display.update",
"pygame.font.Font",
"glob.glob",
"pygame.mouse.get_pos",
"random.randint",
"pygame.display.set_mode",
"pygame.mixer.music.play",
"pygame.transform.scale",
"pygame.display.set_caption",
"pygame.quit",
"levels.L... | [((241, 282), 'pygame.mixer.pre_init', 'pygame.mixer.pre_init', (['(44100)', '(-16)', '(2)', '(512)'], {}), '(44100, -16, 2, 512)\n', (262, 282), False, 'import pygame\n'), ((283, 302), 'pygame.mixer.init', 'pygame.mixer.init', ([], {}), '()\n', (300, 302), False, 'import pygame\n'), ((303, 316), 'pygame.init', 'pygame... |
from django.db import models
from django_server.accounts.models import Account
LANGUAGES = (
(1, 'Python'),
(2, 'C++'),
)
class Problem(models.Model):
class Meta:
verbose_name = "Problem"
verbose_name_plural = "Problems"
teacher = models.ForeignKey(to=Account, on_delete=models.CASCA... | [
"django.db.models.ForeignKey",
"django.db.models.SmallIntegerField",
"django.db.models.PositiveIntegerField",
"django.db.models.CharField"
] | [((268, 323), 'django.db.models.ForeignKey', 'models.ForeignKey', ([], {'to': 'Account', 'on_delete': 'models.CASCADE'}), '(to=Account, on_delete=models.CASCADE)\n', (285, 323), False, 'from django.db import models\n'), ((336, 368), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(100)'}), '(max_... |
"""
Automatic tests for python-ldap's module ldap.modlist
See https://www.python-ldap.org/ for details.
"""
import os
import unittest
# Switch off processing .ldaprc or ldap.conf before importing _ldap
os.environ['LDAPNOINIT'] = '1'
import ldap
from ldap.modlist import addModlist,modifyModlist
class TestModlist(u... | [
"unittest.main",
"ldap.modlist.addModlist",
"ldap.modlist.modifyModlist"
] | [((4619, 4634), 'unittest.main', 'unittest.main', ([], {}), '()\n', (4632, 4634), False, 'import unittest\n'), ((1089, 1106), 'ldap.modlist.addModlist', 'addModlist', (['entry'], {}), '(entry)\n', (1099, 1106), False, 'from ldap.modlist import addModlist, modifyModlist\n'), ((4095, 4182), 'ldap.modlist.modifyModlist', ... |
import sys
import time
import glob
import uuid
import socket
import datetime
from operator import attrgetter
import traceback
from six import string_types as basestring
import six.moves.queue as queue
import re
import os
from os.path import isfile, join
from hashlib import md5
import shutil
import tempfile
import ujso... | [
"os.remove",
"util.load_object",
"datetime.datetime.utcnow",
"glob.glob",
"os.path.join",
"diskdict.DiskDict",
"six.moves.queue.Queue",
"socket.gethostname",
"util.start_daemon_thread",
"traceback.format_exc",
"ujson.dumps",
"pygtail.Pygtail",
"hashlib.md5",
"util.ensure_dir",
"time.slee... | [((808, 835), 'util.load_object', 'util.load_object', (['formatter'], {}), '(formatter)\n', (824, 835), False, 'import util\n'), ((1677, 1697), 'socket.gethostname', 'socket.gethostname', ([], {}), '()\n', (1695, 1697), False, 'import socket\n'), ((1802, 1831), 're.compile', 're.compile', (['"""[a-fA-F\\\\d]{32}"""'], ... |
import json
from tempfile import NamedTemporaryFile
import pytest
from cofi_store import CheckoutIssuer
from tests.constants import VALID_JSON
def get_checkout(content: dict = VALID_JSON):
with NamedTemporaryFile("w+") as temp:
temp.write(json.dumps(content))
temp.seek(0)
issuer = Checko... | [
"pytest.mark.parametrize",
"tempfile.NamedTemporaryFile",
"cofi_store.CheckoutIssuer",
"json.dumps"
] | [((503, 647), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""products,total"""', "[(['VOUCHER', 'VOUCHER', 'TSHIRT', 'MUG'], 32.5), (['TSHIRT', 'TSHIRT',\n 'TSHIRT', 'TSHIRT'], 76)]"], {}), "('products,total', [(['VOUCHER', 'VOUCHER', 'TSHIRT',\n 'MUG'], 32.5), (['TSHIRT', 'TSHIRT', 'TSHIRT', 'TSHIRT... |
#!/usr/bin/env python
"""
delete_duplicates.py
Scan the specified file path and for any files found check if they are in the
DMT, and if so delete this copy if they are already in the CEDA archive.
"""
import argparse
import logging.config
from pathlib import Path
import django
django.setup()
from pdata_app.models im... | [
"django.setup",
"argparse.ArgumentParser",
"pathlib.Path",
"pdata_app.models.DataFile.objects.get",
"pdata_app.utils.common.ilist_files"
] | [((281, 295), 'django.setup', 'django.setup', ([], {}), '()\n', (293, 295), False, 'import django\n'), ((563, 619), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Delete duplicates"""'}), "(description='Delete duplicates')\n", (586, 619), False, 'import argparse\n'), ((1292, 1340), 'pdat... |
#!/usr/bin/env python
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the... | [
"pkg_resources.parse_version",
"os.path.dirname"
] | [((2872, 2889), 'os.path.dirname', 'dirname', (['__file__'], {}), '(__file__)\n', (2879, 2889), False, 'from os.path import dirname, join\n'), ((6188, 6214), 'pkg_resources.parse_version', 'parse_version', (['sys.version'], {}), '(sys.version)\n', (6201, 6214), False, 'from pkg_resources import parse_version\n'), ((621... |
"""
Custom url route mappings
=========================
This is a collection of url maps for Flask applications.
Flask do not have any native map for mongodb ObjectId (Eve uses regex)
Usage:
app.url_map.converters['objectid'] = ObjectIDConverter
then you can
@app.rout... | [
"werkzeug.routing.ValidationError",
"bson.objectid.ObjectId"
] | [((720, 735), 'bson.objectid.ObjectId', 'ObjectId', (['value'], {}), '(value)\n', (728, 735), False, 'from bson.objectid import ObjectId\n'), ((805, 822), 'werkzeug.routing.ValidationError', 'ValidationError', ([], {}), '()\n', (820, 822), False, 'from werkzeug.routing import BaseConverter, ValidationError\n')] |
from proteus import *
from kappa_p import *
from proteus import Context
ct = Context.get()
timeIntegration = BackwardEuler_cfl
stepController = Min_dt_cfl_controller
femSpaces = {0:basis}
massLumping = False
numericalFluxType = Kappa.NumericalFlux
conservativeFlux = None
subgridError = Kappa.SubgridErr... | [
"proteus.Context.get"
] | [((78, 91), 'proteus.Context.get', 'Context.get', ([], {}), '()\n', (89, 91), False, 'from proteus import Context\n')] |
from utils.preprocessSMD import load_SMD
from utils.preprocessMWOZ import load_MWOZ, load_MWOZ_SINGLE
from utils.preprocessDIALKG import load_DIALKG
from utils.preprocessTASKMASTER import load_TASKMASTER
from utils.preprocessCAMRES import load_CAMREST
from utils.preprocessBABI import load_BABI, load_DSTC2
from transfor... | [
"pprint.pformat",
"utils.hugging_face.make_logdir",
"utils.preprocessSMD.load_SMD",
"ignite.contrib.handlers.ProgressBar",
"torch.device",
"torch.no_grad",
"os.path.join",
"ignite.metrics.RunningAverage",
"ignite.metrics.MetricsLambda",
"apex.amp.master_params",
"ignite.contrib.handlers.tensorbo... | [((962, 974), 'utils.hugging_face.get_parser', 'get_parser', ([], {}), '()\n', (972, 974), False, 'from utils.hugging_face import load_model, get_parser, SPECIAL_TOKENS, MODEL_INPUTS, add_special_tokens_, average_distributed_scalar, make_logdir, add_token_bAbI\n'), ((1309, 1325), 'utils.hugging_face.load_model', 'load_... |
from reportlab.graphics.shapes import *
from reportlab.lib import colors
from reportlab.graphics import renderPDF
data = [
# Year Month Predicted High Low
(2007, 8, 113.2, 114.2, 112.2),
(2007, 9, 112.8, 115.8, 109.8),
(2007, 10, 111.0, 116.0, 106.0),
(2007, 11, 109.8, 116.8, 102.8),
(2007, 12,... | [
"reportlab.graphics.renderPDF.drawToFile"
] | [((1004, 1069), 'reportlab.graphics.renderPDF.drawToFile', 'renderPDF.drawToFile', (['drawing', '"""report1.pdf"""', '"""A Sunspots report"""'], {}), "(drawing, 'report1.pdf', 'A Sunspots report')\n", (1024, 1069), False, 'from reportlab.graphics import renderPDF\n')] |
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from keras import initializers
from keras.engine.topology import InputSpec
from keras import backend as K
from ..utils.caps_utils import mixed_shape
from .. import probability_transform... | [
"keras.backend.max",
"keras.backend.name_scope",
"keras.backend.concatenate",
"keras.backend.reshape",
"keras.backend.flatten",
"keras.backend.expand_dims",
"keras.backend.arange",
"keras.backend.gather",
"keras.backend.exp",
"keras.backend.sum",
"keras.backend.batch_dot",
"keras.backend.zeros... | [((8579, 8613), 'keras.initializers.get', 'initializers.get', (['beta_initializer'], {}), '(beta_initializer)\n', (8595, 8613), False, 'from keras import initializers\n'), ((17756, 17801), 'keras.initializers.serialize', 'initializers.serialize', (['self.beta_initializer'], {}), '(self.beta_initializer)\n', (17778, 178... |
#!/usr/bin/env python
from __future__ import print_function
import os
import sys
import json
import argparse
import logging
import fnmatch
import rethinkdb
LOG = logging.getLogger('shotgunCache')
SCRIPT_DIR = os.path.dirname(__file__)
DEFAULT_CONFIG_PATH = '~/shotguncache'
CONFIG_PATH_ENV_KEY = 'SHOTGUN_CACHE_CONFIG... | [
"os.mkdir",
"argparse.ArgumentParser",
"rethinkdb.connect",
"logging.getLogger",
"shotgunCache.CountValidator",
"os.path.join",
"zmq.Context",
"shotgunCache.EntityConfigManager",
"os.path.abspath",
"os.path.dirname",
"os.path.exists",
"shotgunCache.prettyJson",
"shotgunCache.addNumberSign",
... | [((165, 198), 'logging.getLogger', 'logging.getLogger', (['"""shotgunCache"""'], {}), "('shotgunCache')\n", (182, 198), False, 'import logging\n'), ((212, 237), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (227, 237), False, 'import os\n'), ((23115, 23139), 'os.path.expanduser', 'os.path.ex... |
import unittest
from phevaluator.tables import NO_FLUSH_7
from .utils import BaseTestNoFlushTable
class TestNoFlush7Table(BaseTestNoFlushTable):
TOCOMPARE = NO_FLUSH_7
TABLE = [0] * len(TOCOMPARE)
VISIT = [0] * len(TOCOMPARE)
NUM_CARDS = 7
@classmethod
def setUpClass(cls):
super().s... | [
"unittest.main"
] | [((458, 473), 'unittest.main', 'unittest.main', ([], {}), '()\n', (471, 473), False, 'import unittest\n')] |
import cx_Freeze
import sys
import os
import os
os.environ['TCL_LIBRARY'] = "C:\\Users\\kimbe\\Anaconda3\\tcl\\tcl8.6"
os.environ['TK_LIBRARY'] = "C:\\Users\\kimbe\\Anaconda3\\tcl\\tk8.6"
base= None
if sys.platform == 'win32':
base='Win32GUI'
executables= [cx_Freeze.Executable('interface.py', base=base, icon = 'ET... | [
"cx_Freeze.setup",
"cx_Freeze.Executable"
] | [((334, 772), 'cx_Freeze.setup', 'cx_Freeze.setup', ([], {'name': '"""Easy_Text"""', 'options': "{'build_exe': {'packages': ['tkinter'], 'include_files': ['ET_Logo.ico', (\n 'C:\\\\\\\\Users\\\\\\\\kimbe\\\\\\\\Anaconda3\\\\\\\\tcl\\\\\\\\tcl8.6', 'tcl'), (\n 'C:\\\\\\\\Users\\\\\\\\kimbe\\\\\\\\Anaconda3\\\\\\\\... |
import csv
import datetime
LAST_RUN_FILE = "lastrun.txt"
# original_fields = [
# "Title",
# "Author",
# "Item Type",
# "Publication Year",
# "Publication Title",
# "Date Added",
# "Conference Name",
# "Key",
# ]
new_fields = [
"Title",
"Authors",
"Type",
"Year",
"P... | [
"csv.DictReader",
"datetime.datetime",
"datetime.datetime.strptime",
"datetime.datetime.now",
"csv.DictWriter"
] | [((947, 970), 'csv.DictReader', 'csv.DictReader', (['csvfile'], {}), '(csvfile)\n', (961, 970), False, 'import csv\n'), ((1073, 1131), 'csv.DictWriter', 'csv.DictWriter', (['outfile', 'new_fields'], {'extrasaction': '"""ignore"""'}), "(outfile, new_fields, extrasaction='ignore')\n", (1087, 1131), False, 'import csv\n')... |
"""Example script for EV charging study."""
import numpy as np
import os
import pandas as pd
import plotly.express as px
import plotly.graph_objects as go
import scipy.sparse as sp
import mesmo
def main():
# Settings.
scenario_basename = 'singapore_geylang'
results_path = mesmo.utils.get_results_path(_... | [
"mesmo.utils.get_results_path",
"mesmo.plots.plot_histogram_cumulative_branch_utilization",
"mesmo.problems.OptimalOperationProblem",
"mesmo.utils.launch",
"mesmo.data_interface.PriceData",
"mesmo.problems.NominalOperationProblem",
"mesmo.data_interface.recreate_database",
"os.path.normpath",
"numpy... | [((290, 347), 'mesmo.utils.get_results_path', 'mesmo.utils.get_results_path', (['__file__', 'scenario_basename'], {}), '(__file__, scenario_basename)\n', (318, 347), False, 'import mesmo\n'), ((681, 721), 'mesmo.data_interface.recreate_database', 'mesmo.data_interface.recreate_database', ([], {}), '()\n', (719, 721), F... |
#!/usr/bin/env python
import argparse
import os
import subprocess
import re
import hashlib
import tempfile
import logging
import sys
import functools
import inspect
# http://stackoverflow.com/questions/967443
try: # py3
from shlex import quote
except ImportError: # py2
from pipes import quote
# Constants
QU... | [
"functools.partial",
"tempfile.NamedTemporaryFile",
"subprocess.check_call",
"os.pipe",
"argparse.ArgumentParser",
"os.path.isdir",
"os.path.realpath",
"logging.StreamHandler",
"subprocess.check_output",
"re.escape",
"logging.Formatter",
"os.path.isfile",
"os.close",
"pipes.quote",
"insp... | [((4062, 4109), 'os.environ.pop', 'os.environ.pop', (['"""ATJOB_TINYBACKUP_SCRIPT"""', 'None'], {}), "('ATJOB_TINYBACKUP_SCRIPT', None)\n", (4076, 4109), False, 'import os\n'), ((4118, 4127), 'os.pipe', 'os.pipe', ([], {}), '()\n', (4125, 4127), False, 'import os\n'), ((4156, 4167), 'os.close', 'os.close', (['w'], {}),... |
from django.db import models
from users.models import User, Profile
# Create your models here.
class Post(models.Model):
user = models.ForeignKey(User, on_delete=models.CASCADE)
profile = models.ForeignKey(Profile, on_delete=models.CASCADE)
content = models.TextField(blank=True)
photo = models.ImageF... | [
"django.db.models.ForeignKey",
"django.db.models.TextField",
"django.db.models.DateTimeField",
"django.db.models.ImageField"
] | [((134, 183), 'django.db.models.ForeignKey', 'models.ForeignKey', (['User'], {'on_delete': 'models.CASCADE'}), '(User, on_delete=models.CASCADE)\n', (151, 183), False, 'from django.db import models\n'), ((198, 250), 'django.db.models.ForeignKey', 'models.ForeignKey', (['Profile'], {'on_delete': 'models.CASCADE'}), '(Pr... |
from dotenv import load_dotenv
import os
from dcd.entities.thing import Thing
from time import sleep
# The thing ID and access token
load_dotenv()
THING_ID = os.environ['THING_ID']
# Instantiate a thing with its credential
my_thing = Thing(thing_id=THING_ID, private_key_path="/etc/ssl/certs/" + THING_ID + "... | [
"dotenv.load_dotenv",
"dcd.entities.thing.Thing",
"os.popen"
] | [((141, 154), 'dotenv.load_dotenv', 'load_dotenv', ([], {}), '()\n', (152, 154), False, 'from dotenv import load_dotenv\n'), ((246, 338), 'dcd.entities.thing.Thing', 'Thing', ([], {'thing_id': 'THING_ID', 'private_key_path': "('/etc/ssl/certs/' + THING_ID + '.private.pem')"}), "(thing_id=THING_ID, private_key_path='/et... |
"""Test slow integration algorithm"""
import sys
import numpy as np
import odtbrain
from common_methods import create_test_sino_2d, cutout, \
get_test_parameter_set, write_results, get_results
WRITE_RES = False
def test_2d_integrate():
myframe = sys._getframe()
sino, angles = create_test_sino_2d()
... | [
"common_methods.write_results",
"common_methods.cutout",
"sys._getframe",
"common_methods.get_results",
"common_methods.create_test_sino_2d",
"numpy.array",
"common_methods.get_test_parameter_set",
"odtbrain.integrate_2d"
] | [((259, 274), 'sys._getframe', 'sys._getframe', ([], {}), '()\n', (272, 274), False, 'import sys\n'), ((294, 315), 'common_methods.create_test_sino_2d', 'create_test_sino_2d', ([], {}), '()\n', (313, 315), False, 'from common_methods import create_test_sino_2d, cutout, get_test_parameter_set, write_results, get_results... |
import math
import cmath
class UserBullet:
def __init__(self, pos: list, speed: int):
self.pos = pos
self.speed = speed
def update(self):
self.pos[1] -= self.speed
class EnemyBullet:
def __init__(self, x, y, speed: int, direction: int):
self.x = x
self.y = y
... | [
"math.radians",
"cmath.rect"
] | [((414, 442), 'math.radians', 'math.radians', (['self.direction'], {}), '(self.direction)\n', (426, 442), False, 'import math\n'), ((491, 527), 'cmath.rect', 'cmath.rect', (['self.speed', 'self._radian'], {}), '(self.speed, self._radian)\n', (501, 527), False, 'import cmath\n')] |
from irctest import cases
from irctest.numerics import RPL_ENDOFNAMES
from irctest.patma import ANYSTR
class NamesTestCase(cases.BaseServerTestCase):
@cases.mark_specifications("RFC1459", "RFC2812", "Modern")
def testNamesInvalidChannel(self):
"""
"There is no error reply for bad channel names... | [
"irctest.cases.mark_specifications"
] | [((157, 214), 'irctest.cases.mark_specifications', 'cases.mark_specifications', (['"""RFC1459"""', '"""RFC2812"""', '"""Modern"""'], {}), "('RFC1459', 'RFC2812', 'Modern')\n", (182, 214), False, 'from irctest import cases\n'), ((973, 1030), 'irctest.cases.mark_specifications', 'cases.mark_specifications', (['"""RFC1459... |
from TwitterBase.TweetCouch import TweetCouch
DB_NAME = 'tw_test'
COUCH_URL = 'http://127.0.0.1:5984/'
try:
storage = TweetCouch(DB_NAME, COUCH_URL)
storage.compact()
print('TWEETS: %s' % storage.tweet_count())
print('USERS: %s' % storage.user_count())
storage.prune_tweets(storage.tweet_count() - 10)
except E... | [
"TwitterBase.TweetCouch.TweetCouch"
] | [((123, 153), 'TwitterBase.TweetCouch.TweetCouch', 'TweetCouch', (['DB_NAME', 'COUCH_URL'], {}), '(DB_NAME, COUCH_URL)\n', (133, 153), False, 'from TwitterBase.TweetCouch import TweetCouch\n')] |
import torch
from torch import Tensor
from torch import nn
from typing import Union, Tuple, List, Iterable, Dict
import os
import json
class LayerNorm(nn.Module):
def __init__(self, dimension: int):
super(LayerNorm, self).__init__()
self.dimension = dimension
self.norm = nn.Lay... | [
"json.dump",
"json.load",
"torch.nn.LayerNorm",
"torch.device",
"os.path.join"
] | [((314, 337), 'torch.nn.LayerNorm', 'nn.LayerNorm', (['dimension'], {}), '(dimension)\n', (326, 337), False, 'from torch import nn\n'), ((716, 772), 'json.dump', 'json.dump', (["{'dimension': self.dimension}", 'fOut'], {'indent': '(2)'}), "({'dimension': self.dimension}, fOut, indent=2)\n", (725, 772), False, 'import j... |
import sklearn
import sys
import pandas as pd
from sklearn.datasets import load_iris
from sklearn.model_selection import train_test_split
from sklearn import metrics
import statistics
from timeit import default_timer as timer
import multiprocessing
from multiprocessing import Process, Manager
# Uncomment any dataset ... | [
"sklearn.ensemble.RandomForestClassifier",
"sklearn.preprocessing.StandardScaler",
"pandas.read_csv",
"timeit.default_timer",
"sklearn.model_selection.train_test_split",
"multiprocessing.Manager",
"sklearn.metrics.accuracy_score",
"sklearn.metrics.recall_score",
"sklearn.tree.DecisionTreeClassifier"... | [((1098, 1105), 'timeit.default_timer', 'timer', ([], {}), '()\n', (1103, 1105), True, 'from timeit import default_timer as timer\n'), ((1266, 1273), 'timeit.default_timer', 'timer', ([], {}), '()\n', (1271, 1273), True, 'from timeit import default_timer as timer\n'), ((1283, 1316), 'sklearn.linear_model.LogisticRegres... |
from datetime import timedelta
import os
import configparser
wordsPerMinute = 175 # avg is between 125-150, assuming 125 for now
timeBetweenCommentThread = timedelta(seconds=1)
recommendedLength = timedelta(minutes=10)
currentPath = os.path.dirname(os.path.realpath(__file__))
thumbnailpath = currentPath + "/Thumbnail... | [
"os.path.isfile",
"os.path.realpath",
"configparser.ConfigParser",
"datetime.timedelta"
] | [((157, 177), 'datetime.timedelta', 'timedelta', ([], {'seconds': '(1)'}), '(seconds=1)\n', (166, 177), False, 'from datetime import timedelta\n'), ((198, 219), 'datetime.timedelta', 'timedelta', ([], {'minutes': '(10)'}), '(minutes=10)\n', (207, 219), False, 'from datetime import timedelta\n'), ((396, 423), 'configpar... |
# -*- coding: utf-8 -*-
# This file is part of Python Challenge Solutions
# https://github.com/scorphus/PythonChallengeSolutions
# Licensed under the BSD-3-Clause license:
# https://opensource.org/licenses/BSD-3-Clause
# Copyright (c) 2018-2020, <NAME> <<EMAIL>>
# http://www.pythonchallenge.com/
from base64 import ... | [
"urllib.request.Request"
] | [((1008, 1041), 'urllib.request.Request', 'Request', ([], {'url': 'url', 'headers': 'headers'}), '(url=url, headers=headers)\n', (1015, 1041), False, 'from urllib.request import Request\n')] |
#!/usr/bin/env python3
# The support routines for pretty printing Fritzing svg files (and possibly
# other xml as well.)
# Enable detail pretty printing of svg files. If you suspect the detail pretty
# printing is causeing problems, set this to 'n' to disable detail pretty
# printing (and if that fixes it, please rep... | [
"io.BytesIO",
"logging.debug",
"logging.basicConfig",
"os.rename",
"logging.info",
"lxml.etree.XMLParser",
"os.path.isfile",
"lxml.etree.parse",
"re.sub",
"re.compile"
] | [((868, 929), 'logging.basicConfig', 'logging.basicConfig', ([], {'stream': 'sys.stderr', 'level': 'logging.WARNING'}), '(stream=sys.stderr, level=logging.WARNING)\n', (887, 929), False, 'import logging\n'), ((1194, 1244), 'logging.info', 'logging.info', (['""" Entering indent level %s\n"""', 'Level'], {}), "(' Enterin... |
###########################################################################
# Code Parser
#
# This uses the clang Python API to parse and traverse the AST for C++
# code, producing a data model.
###########################################################################
from __future__ import unicode_literals, print_fu... | [
"clang.cindex.Index.create",
"os.path.abspath",
"argparse.ArgumentParser",
"os.path.splitext",
"re.sub"
] | [((61000, 61074), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Display AST structure for C++ file."""'}), "(description='Display AST structure for C++ file.')\n", (61023, 61074), False, 'import argparse\n'), ((734, 748), 'clang.cindex.Index.create', 'Index.create', ([], {}), '()\n', (7... |
import requests
import pprint
import json
access_token = '<KEY>'
url = 'https://sandbox-api.uber.com/v1/requests'
parameters = {
"start_latitude": "37.334381",
"start_longitude": "-121.89432",
"end_latitude": "37.77703",
"end_longitude": "-122.419571",
"product_id": "23a231fd-9fa8-45a7-b212-e3f9cb... | [
"pprint.pprint",
"json.dumps"
] | [((541, 561), 'pprint.pprint', 'pprint.pprint', (['rdata'], {}), '(rdata)\n', (554, 561), False, 'import pprint\n'), ((492, 514), 'json.dumps', 'json.dumps', (['parameters'], {}), '(parameters)\n', (502, 514), False, 'import json\n')] |
#!/usr/bin/env python3
###############################################################################
# Copyright 2018 The Apollo Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy... | [
"modules.tools.common.proto_utils.get_pb_from_file",
"bokeh.plotting.figure",
"argparse.ArgumentParser",
"bokeh.plotting.output_file",
"bokeh.plotting.show",
"modules.map.proto.map_pb2.Map"
] | [((1674, 1687), 'modules.map.proto.map_pb2.Map', 'map_pb2.Map', ([], {}), '()\n', (1685, 1687), False, 'from modules.map.proto import map_pb2\n'), ((1692, 1738), 'modules.tools.common.proto_utils.get_pb_from_file', 'proto_utils.get_pb_from_file', (['map_file', 'map_pb'], {}), '(map_file, map_pb)\n', (1720, 1738), True,... |
"""
Verify the structure of courseware as to it's suitability for import
"""
from argparse import REMAINDER
from django.core.management.base import BaseCommand
from xmodule.modulestore.xml_importer import perform_xlint
class Command(BaseCommand):
"""Verify the structure of courseware as to its suitability for... | [
"xmodule.modulestore.xml_importer.perform_xlint"
] | [((932, 994), 'xmodule.modulestore.xml_importer.perform_xlint', 'perform_xlint', (['data_dir', 'source_dirs'], {'load_error_modules': '(False)'}), '(data_dir, source_dirs, load_error_modules=False)\n', (945, 994), False, 'from xmodule.modulestore.xml_importer import perform_xlint\n')] |
# Copyright 2013 <NAME> <<EMAIL>>
#
# Permission to use, copy, modify, and/or distribute this software for any
# purpose with or without fee is hereby granted, provided that the above
# copyright notice and this permission notice appear in all copies.
#
# THIS SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL W... | [
"os.getcwd"
] | [((2224, 2235), 'os.getcwd', 'os.getcwd', ([], {}), '()\n', (2233, 2235), False, 'import os\n')] |
#from user301_kOICjXGLxt_0 import Vector
from Vector import Vector
import random
try:
import simplegui
except ImportError:
import SimpleGUICS2Pygame.simpleguics2pygame as simplegui
from Sprite import Sprite
width = 400
height = 400
tick = 0
#((self.img.get_height())/2),((self.img.get_width())/2) self.img.ge... | [
"Vector.Vector",
"SimpleGUICS2Pygame.simpleguics2pygame.load_image",
"random.randrange",
"random.randint"
] | [((420, 447), 'random.randrange', 'random.randrange', (['(500)', '(1200)'], {}), '(500, 1200)\n', (436, 447), False, 'import random\n'), ((467, 486), 'Vector.Vector', 'Vector', (['(self.k, 0)'], {}), '((self.k, 0))\n', (473, 486), False, 'from Vector import Vector\n'), ((583, 657), 'SimpleGUICS2Pygame.simpleguics2pygam... |
import mediapipe as mp
import gradio as gr
import cv2
import torch
# Images
torch.hub.download_url_to_file('https://artbreeder.b-cdn.net/imgs/c789e54661bfb432c5522a36553f.jpeg', 'face1.jpg')
torch.hub.download_url_to_file('https://artbreeder.b-cdn.net/imgs/c86622e8cb58d490e35b01cb9996.jpeg', 'face2.jpg')
mp_face_mes... | [
"cv2.cvtColor",
"gradio.inputs.Image",
"gradio.outputs.Image",
"torch.hub.download_url_to_file"
] | [((78, 201), 'torch.hub.download_url_to_file', 'torch.hub.download_url_to_file', (['"""https://artbreeder.b-cdn.net/imgs/c789e54661bfb432c5522a36553f.jpeg"""', '"""face1.jpg"""'], {}), "(\n 'https://artbreeder.b-cdn.net/imgs/c789e54661bfb432c5522a36553f.jpeg',\n 'face1.jpg')\n", (108, 201), False, 'import torch\n... |
"""Utilities for NodePiece."""
import logging
from typing import Collection, Mapping, Optional
import numpy
import scipy.sparse
import torch
from tqdm.auto import tqdm
__all__ = [
"page_rank",
"prepare_page_rank_adjacency",
"edge_index_to_sparse_matrix",
"random_sample_no_replacement",
]
logger = lo... | [
"numpy.full",
"numpy.ones_like",
"tqdm.auto.tqdm",
"torch.randperm",
"logging.getLogger"
] | [((318, 345), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (335, 345), False, 'import logging\n'), ((1781, 1823), 'numpy.full', 'numpy.full', ([], {'shape': '(n,)', 'fill_value': '(1.0 / n)'}), '(shape=(n,), fill_value=1.0 / n)\n', (1791, 1823), False, 'import numpy\n'), ((2091, 2135), ... |
# SPDX-FileCopyrightText: Copyright 2021, <NAME> <<EMAIL>>
# SPDX-License-Identifier: BSD-3-Clause
# SPDX-FileType: SOURCE
#
# This program is free software: you can redistribute it and/or modify it
# under the terms of the license found in the LICENSE.txt file in the root
# directory of this source tree.
# =======
#... | [
"numpy.abs",
"numpy.copy",
"numpy.isscalar",
"numpy.nanstd",
"numpy.empty_like",
"numpy.zeros",
"numpy.isnan",
"numpy.max",
"numpy.nanmean",
"numpy.arange",
"numpy.array",
"numpy.nanmax",
"numpy.sqrt"
] | [((2863, 2901), 'numpy.zeros', 'numpy.zeros', (['samples.shape'], {'dtype': 'bool'}), '(samples.shape, dtype=bool)\n', (2874, 2901), False, 'import numpy\n'), ((2924, 2943), 'numpy.copy', 'numpy.copy', (['samples'], {}), '(samples)\n', (2934, 2943), False, 'import numpy\n'), ((6067, 6092), 'numpy.empty_like', 'numpy.em... |
# Generated by Django 3.0.2 on 2020-01-19 23:36
from django.db import migrations
import game.fields
class Migration(migrations.Migration):
dependencies = [
('game', '0010_auto_20200117_0017'),
]
operations = [
migrations.RenameField(
model_name='game',
old_name='... | [
"django.db.migrations.RenameField"
] | [((243, 351), 'django.db.migrations.RenameField', 'migrations.RenameField', ([], {'model_name': '"""game"""', 'old_name': '"""is_owner_home_start"""', 'new_name': '"""is_owner_home_left"""'}), "(model_name='game', old_name='is_owner_home_start',\n new_name='is_owner_home_left')\n", (265, 351), False, 'from django.db... |
import torch, torchvision, random
import matplotlib.pyplot as plt
from tqdm import tqdm
from loss import MS_SSIMLoss
import pickle
device = torch.device('cuda' if torch.cuda.is_available() else 'cpu')
print("Running on: {}".format(str(device).upper()))
if torch.cuda.is_available():
torch.cuda.empty_cache... | [
"torch.from_numpy",
"torch.nn.ReLU",
"torch.utils.data.DataLoader",
"random.shuffle",
"torchvision.transforms.Normalize",
"torch.nn.Conv2d",
"torch.cat",
"loss.MS_SSIMLoss",
"torch.nn.Upsample",
"torch.nn.BatchNorm2d",
"pickle.load",
"torch.cuda.is_available",
"torch.Tensor",
"torch.cuda.e... | [((266, 291), 'torch.cuda.is_available', 'torch.cuda.is_available', ([], {}), '()\n', (289, 291), False, 'import torch, torchvision, random\n'), ((335, 379), 'torchvision.models.resnet34', 'torchvision.models.resnet34', ([], {'pretrained': '(True)'}), '(pretrained=True)\n', (362, 379), False, 'import torch, torchvision... |
from ..pyutils.cached_property import cached_property
from ..language import ast
from abc import ABCMeta, abstractmethod
import six
# Necessary for static type checking
if False: # flake8: noqa
from typing import Dict, Optional, Union, Callable
from ..language.ast import Document
from ..type.schema impo... | [
"six.with_metaclass"
] | [((360, 387), 'six.with_metaclass', 'six.with_metaclass', (['ABCMeta'], {}), '(ABCMeta)\n', (378, 387), False, 'import six\n')] |
import streamlit as st
import numpy as np
import pandas as pd
#Dataset import
df_growth_rates = pd.read_csv("C:/Users/maria/PycharmProjects/BAA_App/src/data/population-growth-rates.csv")
df = pd.read_csv("C:/Users/maria/PycharmProjects/BAA_App/src/data/UN-population-projection-medium-variant.csv")
#Data Preprocessing... | [
"streamlit.subheader",
"pandas.read_csv",
"streamlit.title",
"streamlit.write",
"scipy.stats.linregress",
"streamlit.number_input"
] | [((97, 197), 'pandas.read_csv', 'pd.read_csv', (['"""C:/Users/maria/PycharmProjects/BAA_App/src/data/population-growth-rates.csv"""'], {}), "(\n 'C:/Users/maria/PycharmProjects/BAA_App/src/data/population-growth-rates.csv'\n )\n", (108, 197), True, 'import pandas as pd\n'), ((193, 309), 'pandas.read_csv', 'pd.rea... |
"""
Main pytuya-redux module
"""
from threading import Lock
import logging
import time
from .device_maps import (create_reverse_device_map, oittm)
from .api_client import ApiClient
name = "python-tuya-oittm"
SLEEP_ON_FAILURE_SECONDS = 5
LOCK = Lock()
LOG = logging.getLogger(__name__)
class TuyaClient:
"""
... | [
"threading.Lock",
"logging.getLogger",
"time.sleep"
] | [((247, 253), 'threading.Lock', 'Lock', ([], {}), '()\n', (251, 253), False, 'from threading import Lock\n'), ((260, 287), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (277, 287), False, 'import logging\n'), ((2277, 2313), 'time.sleep', 'time.sleep', (['SLEEP_ON_FAILURE_SECONDS'], {}), ... |
import datetime
import re
from typing import Text, Generator
from scrapers.scrapers import Scraper
class BivolStrategy(Scraper):
def get_name(self) -> Text:
return 'bivol'
def get_list_url(self) -> Text:
URL = 'https://bivol.bg/'
return URL
def list_articles(self, soup) -> Gener... | [
"re.match",
"datetime.datetime"
] | [((1242, 1275), 're.match', 're.match', (['regex', 'date', 're.VERBOSE'], {}), '(regex, date, re.VERBOSE)\n', (1250, 1275), False, 'import re\n'), ((1512, 1547), 'datetime.datetime', 'datetime.datetime', (['y', 'm', 'd', 'H', 'M', 'S'], {}), '(y, m, d, H, M, S)\n', (1529, 1547), False, 'import datetime\n')] |
import numpy as np
import matplotlib.pyplot as plt
from cal import add
import json
x = [[1, 2, 3, 4], [5, 6, 7, 8]]
print(x)
a = np.array(x)
print(a)
# %matplotlib inline
x = np.linspace(0, 10, 100)
y = x ** 2
plt.plot(x, y)
# from cal import add
print(add(1, 3))
# json
x = {"name": "<NAME>"}
y = json.dumps(x)
pri... | [
"matplotlib.pyplot.plot",
"json.dumps",
"numpy.array",
"numpy.linspace",
"cal.add"
] | [((131, 142), 'numpy.array', 'np.array', (['x'], {}), '(x)\n', (139, 142), True, 'import numpy as np\n'), ((178, 201), 'numpy.linspace', 'np.linspace', (['(0)', '(10)', '(100)'], {}), '(0, 10, 100)\n', (189, 201), True, 'import numpy as np\n'), ((213, 227), 'matplotlib.pyplot.plot', 'plt.plot', (['x', 'y'], {}), '(x, y... |
#! /usr/bin/env python3
# -*- coding: utf-8 -*-
import sys
from common import Values
from ast import ASTGenerator
from six.moves import cStringIO
from pysmt.smtlib.parser import SmtLibParser
from common.Utilities import backup_file, restore_file, reset_git, error_exit
from pysmt.shortcuts import get_model
from common... | [
"Extractor.extract_source_list",
"KleeExecutor.generate_var_expressions",
"Builder.build_instrumented_code",
"Mapper.map_variable",
"six.moves.cStringIO",
"Collector.collect_values",
"KleeExecutor.generate_values",
"Emitter.warning",
"Instrumentor.instrument_klee_var_expr",
"Mapper.map_source_func... | [((894, 947), 'Emitter.normal', 'Emitter.normal', (['"""\t\tgenerating variable information"""'], {}), "('\\t\\tgenerating variable information')\n", (908, 947), False, 'import Emitter\n'), ((2319, 2434), 'Instrumentor.instrument_klee_var_expr', 'Instrumentor.instrument_klee_var_expr', (['source_path', 'start_line', 'e... |
import os
from shutil import copyfile
import random
import torch
import numpy as np
import json
from ptutils import PytorchLoop
def start_task(config, config_path):
if os.path.exists(config['log_path']):
config['log_path'] = config['log_path'] + '_new'
return start_task(config, config_path)
os... | [
"numpy.random.seed",
"os.makedirs",
"torch.manual_seed",
"ptutils.PytorchLoop.PytorchLoop",
"os.path.exists",
"json.dumps",
"random.seed",
"os.path.join"
] | [((173, 207), 'os.path.exists', 'os.path.exists', (["config['log_path']"], {}), "(config['log_path'])\n", (187, 207), False, 'import os\n'), ((318, 349), 'os.makedirs', 'os.makedirs', (["config['log_path']"], {}), "(config['log_path'])\n", (329, 349), False, 'import os\n'), ((893, 926), 'torch.manual_seed', 'torch.manu... |
try:
from .secrets import *
except ImportError:
import sys
sys.exit('secrets.py settings file not found. Please run `prepare.sh` to create one.')
from .base import *
#
# We need this specific override because having the salesforce app and bluebottle_salesforce
# enabled causes tests to fail in our other ... | [
"sys.exit"
] | [((71, 167), 'sys.exit', 'sys.exit', (['"""secrets.py settings file not found. Please run `prepare.sh` to create one."""'], {}), "(\n 'secrets.py settings file not found. Please run `prepare.sh` to create one.'\n )\n", (79, 167), False, 'import sys\n')] |
import appJar
import json
from MXDRV import MXDRV
app = MXDRV()
gui = appJar.gui(title="X68000 MDX Manager")
dirs=[]
def search():
q = gui.getEntry("Query")
if not q or q=="":
return
res = app.search(q)
if not res:
gui.errorBox("No results", "Couldn't find anything for '{}'. Try rescann... | [
"MXDRV.MXDRV",
"appJar.gui",
"json.dumps"
] | [((56, 63), 'MXDRV.MXDRV', 'MXDRV', ([], {}), '()\n', (61, 63), False, 'from MXDRV import MXDRV\n'), ((70, 108), 'appJar.gui', 'appJar.gui', ([], {'title': '"""X68000 MDX Manager"""'}), "(title='X68000 MDX Manager')\n", (80, 108), False, 'import appJar\n'), ((1012, 1031), 'json.dumps', 'json.dumps', (['app.cfg'], {}), ... |
from django.apps import apps
from django.contrib.auth import get_user_model
from django.contrib.contenttypes.models import ContentType
from django.dispatch import receiver
from cms import api
from cms.models import Placeholder, pagemodel, titlemodels
from cms.operations import ADD_PAGE_TRANSLATION, CHANGE_PAGE_TRANSLA... | [
"djangocms_versioning.models.Version.objects.create",
"django.dispatch.receiver",
"django.contrib.auth.get_user_model",
"django.contrib.contenttypes.models.ContentType.objects.get_for_model",
"djangocms_versioning.models.Version.objects.filter",
"django.apps.apps.get_app_config",
"cms.models.Placeholder... | [((528, 544), 'django.contrib.auth.get_user_model', 'get_user_model', ([], {}), '()\n', (542, 544), False, 'from django.contrib.auth import get_user_model\n'), ((1461, 1489), 'django.dispatch.receiver', 'receiver', (['post_obj_operation'], {}), '(post_obj_operation)\n', (1469, 1489), False, 'from django.dispatch import... |
# Copyright 2019 Google LLC. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ... | [
"tensorflow.test.main",
"tensorflow_transform.beam.AnalyzeAndTransformDataset",
"apache_beam.Map",
"tfx.examples.chicago_taxi_pipeline.taxi_utils.trainer_fn",
"os.path.dirname",
"apache_beam.coders.BytesCoder",
"tensorflow_transform.beam.WriteTransformFn",
"tfx.examples.chicago_taxi_pipeline.taxi_util... | [((5922, 5936), 'tensorflow.test.main', 'tf.test.main', ([], {}), '()\n', (5934, 5936), True, 'import tensorflow as tf\n'), ((1451, 1484), 'tfx.examples.chicago_taxi_pipeline.taxi_utils._transformed_name', 'taxi_utils._transformed_name', (['key'], {}), '(key)\n', (1479, 1484), False, 'from tfx.examples.chicago_taxi_pip... |
# -*- coding: utf-8 -*-
"""
Created on Tue Apr 6 12:31:50 2021
@author: Aditya
"""
import cv2
import mediapipe as mp
# import time
cap = cv2.VideoCapture(0)
mpHands = mp.solutions.hands
hands = mpHands.Hands()
mpDraw = mp.solutions.drawing_utils
pTime = 0
cTime = 0
with mpHands.Hands(
min_de... | [
"cv2.cvtColor",
"cv2.waitKey",
"cv2.imshow",
"cv2.VideoCapture",
"cv2.destroyAllWindows"
] | [((148, 167), 'cv2.VideoCapture', 'cv2.VideoCapture', (['(0)'], {}), '(0)\n', (164, 167), False, 'import cv2\n'), ((1085, 1108), 'cv2.destroyAllWindows', 'cv2.destroyAllWindows', ([], {}), '()\n', (1106, 1108), False, 'import cv2\n'), ((460, 496), 'cv2.cvtColor', 'cv2.cvtColor', (['img', 'cv2.COLOR_BGR2RGB'], {}), '(im... |
from django.contrib.auth.decorators import login_required
import json
from django.core.mail import EmailMultiAlternatives, send_mail
from django.utils.html import strip_tags
from django.template.loader import render_to_string
from random import randint
import re
from django.shortcuts import render, redirect
from django... | [
"django.contrib.messages.error",
"django.contrib.auth.models.User.objects.filter",
"django.contrib.auth.models.User.objects.create_user",
"django.http.JsonResponse",
"django.contrib.messages.info",
"requests.post",
"django.contrib.auth.login",
"random.randint",
"django.contrib.auth.models.User.objec... | [((929, 952), 're.search', 're.search', (['regex', 'email'], {}), '(regex, email)\n', (938, 952), False, 'import re\n'), ((1168, 1205), 'django.shortcuts.render', 'render', (['request', '"""home.html"""', 'context'], {}), "(request, 'home.html', context)\n", (1174, 1205), False, 'from django.shortcuts import render, re... |
# Generated by Django 2.1.4 on 2020-06-04 11:15
from django.contrib.auth.models import Group
from django.db import migrations
GROUPS = ["admin", "secretary", "planner"]
# Delete groups that used to be generated in 0002 if
# they exist and are unused
def delete_groups(apps, schema_editor):
for group in GROUPS:
... | [
"django.db.migrations.RunPython",
"django.contrib.auth.models.Group.objects.get"
] | [((678, 713), 'django.db.migrations.RunPython', 'migrations.RunPython', (['delete_groups'], {}), '(delete_groups)\n', (698, 713), False, 'from django.db import migrations\n'), ((355, 384), 'django.contrib.auth.models.Group.objects.get', 'Group.objects.get', ([], {'name': 'group'}), '(name=group)\n', (372, 384), False, ... |
import configparser as cfg
import argparse
import os
from flags import Flags
from xml_builder import buildProject
def createArgParser():
parser = argparse.ArgumentParser(description='Create new project from project template')
parser.add_argument('project_path', help='Path to the project')
parser.add_argument('-m'... | [
"flags.Flags",
"argparse.ArgumentParser",
"os.path.isdir",
"os.getcwd",
"xml_builder.buildProject",
"configparser.ConfigParser"
] | [((150, 229), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Create new project from project template"""'}), "(description='Create new project from project template')\n", (173, 229), False, 'import argparse\n'), ((1174, 1192), 'configparser.ConfigParser', 'cfg.ConfigParser', ([], {}), '(... |
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import math
from dataclasses import dataclass, field
from typing import Optional
from fairseq.dataclass.configs import FairseqDataclass
from ... | [
"dataclasses.field",
"fairseq.dataclass.constants.ChoiceEnum"
] | [((416, 461), 'fairseq.dataclass.constants.ChoiceEnum', 'ChoiceEnum', (["['viterbi', 'kenlm', 'fairseqlm']"], {}), "(['viterbi', 'kenlm', 'fairseqlm'])\n", (426, 461), False, 'from fairseq.dataclass.constants import ChoiceEnum\n'), ((542, 615), 'dataclasses.field', 'field', ([], {'default': '"""viterbi"""', 'metadata':... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.