repo_name
stringlengths
7
94
repo_path
stringlengths
4
237
repo_head_hexsha
stringlengths
40
40
content
stringlengths
10
680k
apis
stringlengths
2
680k
ryangillard/misc
leetcode/970_powerful_integers/970_powerful_integers.py
d1f9919400636e6b988fa933493b94829a73331e
class Solution(object): def powerfulIntegers(self, x, y, bound): """ :type x: int :type y: int :type bound: int :rtype: List[int] """ # Find max exponent base = max(x, y) if x == 1 or y == 1 else min(x, y) exponent = 1 if base != 1: ...
[]
jSkrod/djangae-react-browser-games-app
src/project/api/rankings/urls.py
28c5064f0a126021afb08b195839305aba6b35a2
from django.conf.urls import url, include from project.api.rankings.api import AddRanking, AddScore, GetScoresUser, GetScoresGame urlpatterns = [ url(r'add_ranking$', AddRanking.as_view()), url(r'add_score$', AddScore.as_view()), url(r'get_scores_game$', GetScoresGame.as_view()), url(r'get_scores_user$...
[((172, 192), 'project.api.rankings.api.AddRanking.as_view', 'AddRanking.as_view', ([], {}), '()\n', (190, 192), False, 'from project.api.rankings.api import AddRanking, AddScore, GetScoresUser, GetScoresGame\n'), ((218, 236), 'project.api.rankings.api.AddScore.as_view', 'AddScore.as_view', ([], {}), '()\n', (234, 236)...
wdczdj/qiskit-metal
qiskit_metal/qlibrary/lumped/cap_n_interdigital.py
c77805f66da60021ef8d10d668715c1dc2ebcd1d
# -*- coding: utf-8 -*- # This code is part of Qiskit. # # (C) Copyright IBM 2017, 2021. # # This code is licensed under the Apache License, Version 2.0. You may # obtain a copy of this license in the LICENSE.txt file in the root directory # of this source tree or at http://www.apache.org/licenses/LICENSE-2.0. # # Any...
[((2823, 2910), 'qiskit_metal.Dict', 'Dict', ([], {'short_name': '"""cpw"""', '_qgeometry_table_poly': '"""True"""', '_qgeometry_table_path': '"""True"""'}), "(short_name='cpw', _qgeometry_table_poly='True', _qgeometry_table_path=\n 'True')\n", (2827, 2910), False, 'from qiskit_metal import draw, Dict\n'), ((3158, 3...
getcircle/luno-ios
ThirdParty/protobuf-registry/python/protobufs/services/feature/actions/get_flags_pb2.py
d18260abb537496d86cf607c170dd5e91c406f0f
# Generated by the protocol buffer compiler. DO NOT EDIT! # source: protobufs/services/feature/actions/get_flags.proto from google.protobuf import descriptor as _descriptor from google.protobuf import message as _message from google.protobuf import reflection as _reflection from google.protobuf import symbol_database...
[((431, 457), 'google.protobuf.symbol_database.Default', '_symbol_database.Default', ([], {}), '()\n', (455, 457), True, 'from google.protobuf import symbol_database as _symbol_database\n'), ((475, 996), 'google.protobuf.descriptor.FileDescriptor', '_descriptor.FileDescriptor', ([], {'name': '"""protobufs/services/feat...
Hellofafar/Leetcode
Medium/102_2.py
7a459e9742958e63be8886874904e5ab2489411a
# ------------------------------ # Binary Tree Level Order Traversal # # Description: # Given a binary tree, return the level order traversal of its nodes' values. (ie, from # left to right, level by level). # # For example: # Given binary tree [3,9,20,null,null,15,7], # 3 # / \ # 9 20 # / \ # 15 ...
[]
qiaone/GIF
mturk/comparison_among_different_models/sample_from_models_for_comparison.py
2c551e844748c72395fc91fb080c7a2f9c8d5285
import sys sys.path.append('../../') import constants as cnst import os os.environ['PYTHONHASHSEED'] = '2' import tqdm from model.stg2_generator import StyledGenerator import numpy as np from my_utils.visualize_flame_overlay import OverLayViz from my_utils.flm_dynamic_fit_overlay import camera_ringnetpp from my_utils.g...
[((11, 36), 'sys.path.append', 'sys.path.append', (['"""../../"""'], {}), "('../../')\n", (26, 36), False, 'import sys\n'), ((1244, 1267), 'numpy.array', 'np.array', (['[0.0, 0.0, 0]'], {}), '([0.0, 0.0, 0])\n', (1252, 1267), True, 'import numpy as np\n'), ((1282, 1338), 'my_utils.flm_dynamic_fit_overlay.camera_ringnet...
philippWassibauer/django-activity-stream
setup.py
766a372aea4803ef5fe051a5de16dde5b5efcc72
from distutils.core import setup """ django-activity-stream instalation script """ setup( name = 'activity_stream', description = 'generic activity feed system for users', author = 'Philipp Wassibauer', author_email = 'phil@maptales.com', url='http://github.com/philippWassibauer/django-activity-st...
[]
study-machine-learning/dongheon.shin
02/selenium.02.py
6103ef9c73b162603bc39a27e4ecca0f1ac35e57
from selenium import webdriver username = "henlix" password = "my_password" browser = webdriver.PhantomJS() browser.implicitly_wait(5) url_login = "https://nid.naver.com/nidlogin.login" browser.get(url_login) el = browser.find_element_by_id("id") el.clear() el.send_keys(username) el = browser.find_element_by_id("p...
[((88, 109), 'selenium.webdriver.PhantomJS', 'webdriver.PhantomJS', ([], {}), '()\n', (107, 109), False, 'from selenium import webdriver\n')]
Licas/datascienceexamples
visualization/matplotlib/barwitherror.py
cbb1293dbae875cb3f166dbde00b2ab629a43ece
from matplotlib import pyplot as plt drinks = ["cappuccino", "latte", "chai", "americano", "mocha", "espresso"] ounces_of_milk = [6, 9, 4, 0, 9, 0] error = [0.6, 0.9, 0.4, 0, 0.9, 0] #Yerr -> element at i position represents +/- error[i] variance on bar[i] value plt.bar( range(len(drinks)),ounces_of_milk, yerr=error,...
[((333, 343), 'matplotlib.pyplot.show', 'plt.show', ([], {}), '()\n', (341, 343), True, 'from matplotlib import pyplot as plt\n')]
matan-xmcyber/content
Packs/mnemonicMDR/Integrations/ArgusManagedDefence/ArgusManagedDefence.py
7f02301c140b35956af3cd20cb8dfc64f34afb3e
import demistomock as demisto from CommonServerPython import * """ IMPORTS """ import json import urllib3 import dateparser import traceback from typing import Any, Dict, List, Union import logging from argus_api import session as argus_session from argus_api.api.currentuser.v1.user import get_current_user from ...
[((1357, 1383), 'urllib3.disable_warnings', 'urllib3.disable_warnings', ([], {}), '()\n', (1381, 1383), False, 'import urllib3\n'), ((5694, 5712), 'argus_api.api.currentuser.v1.user.get_current_user', 'get_current_user', ([], {}), '()\n', (5710, 5712), False, 'from argus_api.api.currentuser.v1.user import get_current_u...
SnowWolf75/aoc-2020
03.py
1745a6cf46dac097869e5af99194b710e78bed28
#!/usr/bin/env python3 import sys, os import unittest from lib.common import * filename = "inputs/2020_12_03_input.txt" class day03: def __init__(self): pass class day03part1(day03): def solve(self, args): pass class day03part2(day03): def solve(self, args): pass class exampl...
[]
fortinet/ips-bph-framework
scripts/examples/tools/capturebat.py
145e14cced2181f388ade07d78b4f0e9452143dd
# Tool Imports from bph.tools.windows.capturebat import BphCaptureBat as CaptureBat # Core Imports from bph.core.server.template import BphTemplateServer as TemplateServer from bph.core.sample import BphSample as Sample from bph.core.sample import BphLabFile as LabFile from bph.core.session import BphSession as...
[((342, 387), 'bph.core.session.BphSession', 'Session', ([], {'project_name': '"""blackhat_arsenal_2019"""'}), "(project_name='blackhat_arsenal_2019')\n", (349, 387), True, 'from bph.core.session import BphSession as Session\n'), ((425, 441), 'bph.core.server.template.BphTemplateServer', 'TemplateServer', ([], {}), '()...
kaushikponnapalli/dymos
dymos/utils/test/test_hermite.py
3fba91d0fc2c0e8460717b1bec80774676287739
import unittest import numpy as np from numpy.testing import assert_almost_equal from dymos.utils.hermite import hermite_matrices class TestHermiteMatrices(unittest.TestCase): def test_quadratic(self): # Interpolate with values and rates provided at [-1, 1] in tau space tau_given = [-1.0, 1.0]...
[((2209, 2224), 'unittest.main', 'unittest.main', ([], {}), '()\n', (2222, 2224), False, 'import unittest\n'), ((340, 363), 'numpy.linspace', 'np.linspace', (['(-1)', '(1)', '(100)'], {}), '(-1, 1, 100)\n', (351, 363), True, 'import numpy as np\n'), ((631, 668), 'dymos.utils.hermite.hermite_matrices', 'hermite_matrices...
libris/xl_auth
xl_auth/settings.py
33d705c287d2ecd81920d37c3751d947cd52588c
# -*- coding: utf-8 -*- """Application configuration.""" from __future__ import absolute_import, division, print_function, unicode_literals import os from . import __author__, __name__, __version__ class Config(object): """Base configuration.""" SERVER_NAME = os.environ.get('SERVER_NAME', None) PREFER...
[((274, 309), 'os.environ.get', 'os.environ.get', (['"""SERVER_NAME"""', 'None'], {}), "('SERVER_NAME', None)\n", (288, 309), False, 'import os\n'), ((337, 383), 'os.environ.get', 'os.environ.get', (['"""PREFERRED_URL_SCHEME"""', '"""http"""'], {}), "('PREFERRED_URL_SCHEME', 'http')\n", (351, 383), False, 'import os\n'...
evanreichard/pyatv
tests/mrp/test_mrp_auth.py
d41bd749bbf8f8a9365e7fd36c1164543e334565
"""Functional authentication tests with fake MRP Apple TV.""" import inspect from aiohttp.test_utils import AioHTTPTestCase, unittest_run_loop import pyatv from pyatv import exceptions from pyatv.const import Protocol from pyatv.conf import MrpService, AppleTV from pyatv.mrp.server_auth import PIN_CODE, CLIENT_IDENT...
[((465, 492), 'aiohttp.test_utils.AioHTTPTestCase.setUp', 'AioHTTPTestCase.setUp', (['self'], {}), '(self)\n', (486, 492), False, 'from aiohttp.test_utils import AioHTTPTestCase, unittest_run_loop\n'), ((627, 659), 'pyatv.conf.AppleTV', 'AppleTV', (['"""127.0.0.1"""', '"""Apple TV"""'], {}), "('127.0.0.1', 'Apple TV')\...
maryokhin/drf-extensions
tests_app/tests/functional/key_constructor/bits/models.py
8223db2bdddaf3cd99f951b2291210c5fd5b0e6f
# -*- coding: utf-8 -*- from django.db import models class KeyConstructorUserProperty(models.Model): name = models.CharField(max_length=100) class Meta: app_label = 'tests_app' class KeyConstructorUserModel(models.Model): property = models.ForeignKey(KeyConstructorUserProperty) class Meta:...
[((114, 146), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(100)'}), '(max_length=100)\n', (130, 146), False, 'from django.db import models\n'), ((258, 303), 'django.db.models.ForeignKey', 'models.ForeignKey', (['KeyConstructorUserProperty'], {}), '(KeyConstructorUserProperty)\n', (275, 303), ...
cliveseldon/ngraph-onnx
ngraph_onnx/onnx_importer/utils/numeric_limits.py
a2d20afdc7acd5064e4717612ad372d864d03d3d
# ****************************************************************************** # Copyright 2018 Intel 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.o...
[((2119, 2134), 'numpy.dtype', 'np.dtype', (['dtype'], {}), '(dtype)\n', (2127, 2134), True, 'import numpy as np\n'), ((3240, 3264), 'numpy.finfo', 'np.finfo', (['self.data_type'], {}), '(self.data_type)\n', (3248, 3264), True, 'import numpy as np\n'), ((3456, 3480), 'numpy.finfo', 'np.finfo', (['self.data_type'], {}),...
AbhilashReddyM/curvpack
curvpack/utils.py
74351624ec9ec50ec4445c7be85a48a4eabb029a
import numpy as np # The first two functions are modified from MNE surface project. LIcense follows # This software is OSI Certified Open Source Software. OSI Certified is a certification mark of the Open Source Initiative. # # Copyright (c) 2011-2019, authors of MNE-Python. All rights reserved. # # Redistribu...
[((2389, 2423), 'numpy.bincount', 'np.bincount', (['verts'], {'minlength': 'npts'}), '(verts, minlength=npts)\n', (2400, 2423), True, 'import numpy as np\n'), ((2436, 2453), 'numpy.argsort', 'np.argsort', (['verts'], {}), '(verts)\n', (2446, 2453), True, 'import numpy as np\n'), ((2521, 2548), 'numpy.cumsum', 'np.cumsu...
tethys-platform/tethys
tests/unit/core/streams/test_stream_zero.py
c27daf5a832b05f9d771b04355001c331bc08766
# Copyright 2020 Konstruktor, Inc. 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 la...
[((1104, 1120), 'unittest.mock.MagicMock', 'mock.MagicMock', ([], {}), '()\n', (1118, 1120), False, 'from unittest import mock\n'), ((1138, 1154), 'unittest.mock.MagicMock', 'mock.MagicMock', ([], {}), '()\n', (1152, 1154), False, 'from unittest import mock\n'), ((1610, 1639), 'unittest.mock.MagicMock', 'mock.MagicMock...
qiyancos/Simics-3.0.31
amd64-linux/lib/ppc64_simple_components.py
9bd52d5abad023ee87a37306382a338abf7885f1
## Copyright 2005-2007 Virtutech AB ## ## The contents herein are Source Code which are a subset of Licensed ## Software pursuant to the terms of the Virtutech Simics Software ## License Agreement (the "Agreement"), and are being distributed under ## the Agreement. You should have received a copy of the Agreeme...
[]
shadow0403bsr/AutomatedGradingSoftware
Front-end (Django)/course/migrations/0002_subject_number_of_questions.py
5031d22683a05f937615b3b8997152c285a2f930
# Generated by Django 3.0.1 on 2020-02-15 06:02 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('course', '0001_initial'), ] operations = [ migrations.AddField( model_name='subject', name='Number_Of_Questions', ...
[((336, 366), 'django.db.models.IntegerField', 'models.IntegerField', ([], {'default': '(0)'}), '(default=0)\n', (355, 366), False, 'from django.db import migrations, models\n')]
pchtsp/corn
cornflow/tests/unit/test_dags.py
2811ad400f3f3681a159984eabf4fee1fc99b433
""" Unit test for the DAG endpoints """ # Import from libraries import json # Import from internal modules from cornflow.shared.const import EXEC_STATE_CORRECT, EXEC_STATE_MANUAL from cornflow.tests.const import ( DAG_URL, EXECUTION_URL_NORUN, CASE_PATH, INSTANCE_URL, ) from cornflow.tests.unit.test_e...
[((530, 542), 'json.load', 'json.load', (['f'], {}), '(f)\n', (539, 542), False, 'import json\n'), ((1218, 1230), 'json.load', 'json.load', (['f'], {}), '(f)\n', (1227, 1230), False, 'import json\n'), ((2030, 2042), 'json.load', 'json.load', (['f'], {}), '(f)\n', (2039, 2042), False, 'import json\n')]
xwshi/faster-rcnn-keras
nets/resnet.py
bfd99e3d0e786ada75a212c007111364b2c86312
#-------------------------------------------------------------# # ResNet50的网络部分 #-------------------------------------------------------------# import keras.backend as K from keras import backend as K from keras import initializers, layers, regularizers from keras.engine import InputSpec, Layer from keras.init...
[((5015, 5044), 'keras.layers.add', 'layers.add', (['[x, input_tensor]'], {}), '([x, input_tensor])\n', (5025, 5044), False, 'from keras import initializers, layers, regularizers\n'), ((6269, 6294), 'keras.layers.add', 'layers.add', (['[x, shortcut]'], {}), '([x, shortcut])\n', (6279, 6294), False, 'from keras import i...
congdh/fastapi-realworld
app/api/deps.py
42c8630aedf594b69bc96a327b04dfe636a785fe
from typing import Generator from fastapi import Depends, HTTPException from fastapi.security import APIKeyHeader from sqlalchemy.orm import Session from starlette import status from app import crud, models from app.core import security from app.db.session import SessionLocal JWT_TOKEN_PREFIX = "Token" # noqa: S105...
[((359, 373), 'app.db.session.SessionLocal', 'SessionLocal', ([], {}), '()\n', (371, 373), False, 'from app.db.session import SessionLocal\n'), ((1010, 1043), 'fastapi.Depends', 'Depends', (['authrization_heder_token'], {}), '(authrization_heder_token)\n', (1017, 1043), False, 'from fastapi import Depends, HTTPExceptio...
netcriptus/raiden-services
src/raiden_libs/contract_info.py
3955d91852c616f6ba0a3a979757edbd852b2c6d
import sys from typing import Dict, List, Tuple import structlog from eth_utils import to_canonical_address from raiden.utils.typing import Address, BlockNumber, ChainID, Optional from raiden_contracts.contract_manager import ( ContractDevEnvironment, ContractManager, contracts_precompiled_path, get_c...
[((355, 385), 'structlog.get_logger', 'structlog.get_logger', (['__name__'], {}), '(__name__)\n', (375, 385), False, 'import structlog\n'), ((421, 449), 'raiden_contracts.contract_manager.contracts_precompiled_path', 'contracts_precompiled_path', ([], {}), '()\n', (447, 449), False, 'from raiden_contracts.contract_mana...
letyrodridc/meta-dataset
meta_dataset/models/functional_classifiers.py
d868ea1c767cce46fa6723f6f77c29552754fcc9
# coding=utf-8 # Copyright 2022 The Meta-Dataset Authors. # # 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 ...
[((8433, 8468), 'tensorflow.compat.v1.gather', 'tf.gather', (['num_classes', 'dataset_idx'], {}), '(num_classes, dataset_idx)\n', (8442, 8468), True, 'import tensorflow.compat.v1 as tf\n'), ((2153, 2206), 'tensorflow.compat.v1.nn.l2_normalize', 'tf.nn.l2_normalize', (['embeddings'], {'axis': '(1)', 'epsilon': '(0.001)'...
Shrinidhi-C/Context-Based-Question-Answering
app.py
f2e0bbc03003aae65f4cabddecd5cd9fcdbfb333
import os import threading import shutil from datetime import timedelta, datetime from flask import Flask, render_template, request, session, jsonify, url_for, redirect from haystack.document_store.elasticsearch import * from haystack.preprocessor.utils import convert_files_to_dicts from haystack.preprocessor.cleaning ...
[((544, 559), 'elasticsearch.Elasticsearch', 'Elasticsearch', ([], {}), '()\n', (557, 559), False, 'from elasticsearch import Elasticsearch\n'), ((719, 734), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (724, 734), False, 'from flask import Flask, render_template, request, session, jsonify, url_for, redi...
timevortexproject/timevortex
timevortex/utils/filestorage.py
2bc1a50b255524af8582e6624dee280d64d3c9f3
#!/usr/bin/python3 # -*- coding: utf8 -*- # -*- Mode: Python; py-indent-offset: 4 -*- """File storage adapter for timevortex project""" import os from os import listdir, makedirs from os.path import isfile, join, exists from time import tzname from datetime import datetime import pytz import dateutil.parser from djan...
[((928, 948), 'os.listdir', 'listdir', (['site_folder'], {}), '(site_folder)\n', (935, 948), False, 'from os import listdir, makedirs\n'), ((1590, 1610), 'os.listdir', 'listdir', (['site_folder'], {}), '(site_folder)\n', (1597, 1610), False, 'from os import listdir, makedirs\n'), ((2062, 2101), 'datetime.datetime.strpt...
olegush/quiz-bot
main_tg.py
ae370d42f32c42b290a507924a801c63901d5148
import os import logging import logging.config from functools import partial from dotenv import load_dotenv from telegram import Bot, ReplyKeyboardMarkup, ReplyKeyboardRemove from telegram.ext import (Updater, CommandHandler, MessageHandler, RegexHandler, ConversationHandler, Filters) from red...
[((1196, 1209), 'dotenv.load_dotenv', 'load_dotenv', ([], {}), '()\n', (1207, 1209), False, 'from dotenv import load_dotenv\n'), ((1233, 1262), 'os.getenv', 'os.getenv', (['"""CHAT_ID_TG_ADMIN"""'], {}), "('CHAT_ID_TG_ADMIN')\n", (1242, 1262), False, 'import os\n'), ((1310, 1350), 'logging.config.dictConfig', 'logging....
titu1994/tf_fourier_features
tf_fourier_features/fourier_features_mlp.py
3aead078ae79a278b9975e21f44560a7f51e3f31
import tensorflow as tf from typing import Optional from tf_fourier_features import fourier_features class FourierFeatureMLP(tf.keras.Model): def __init__(self, units: int, final_units: int, gaussian_projection: Optional[int], activation: str = 'relu', final_activation: str = "l...
[((2692, 2719), 'tensorflow.keras.Sequential', 'tf.keras.Sequential', (['layers'], {}), '(layers)\n', (2711, 2719), True, 'import tensorflow as tf\n'), ((2747, 2875), 'tensorflow.keras.layers.Dense', 'tf.keras.layers.Dense', (['final_units'], {'activation': 'final_activation', 'use_bias': 'use_bias', 'bias_initializer'...
fusionbox/eek
eek/spider.py
8e962b7ad80c594a3498190fead016db826771e0
import urlparse import csv import sys import re import collections import time import requests from eek import robotparser # this project's version from bs4 import BeautifulSoup try: import lxml except ImportError: HTML_PARSER = None else: HTML_PARSER = 'lxml' encoding_re = re.compile("charset\s*=\s*(\...
[]
hajime9652/observations
observations/r/zea_mays.py
2c8b1ac31025938cb17762e540f2f592e302d5de
# -*- coding: utf-8 -*- from __future__ import absolute_import from __future__ import division from __future__ import print_function import csv import numpy as np import os import sys from observations.util import maybe_download_and_extract def zea_mays(path): """Darwin's Heights of Cross- and Self-fertilized Zea...
[((2134, 2158), 'os.path.expanduser', 'os.path.expanduser', (['path'], {}), '(path)\n', (2152, 2158), False, 'import os\n'), ((2308, 2395), 'observations.util.maybe_download_and_extract', 'maybe_download_and_extract', (['path', 'url'], {'save_file_name': '"""zea_mays.csv"""', 'resume': '(False)'}), "(path, url, save_fi...
peterkulik/ois_api_client
ois_api_client/v3_0/dto/Lines.py
51dabcc9f920f89982c4419bb058f5a88193cee0
from typing import List from dataclasses import dataclass from .Line import Line @dataclass class Lines: """Product / service items :param merged_item_indicator: Indicates whether the data exchange contains merged line data due to size reduction :param line: Product / service item """ merged_ite...
[]
leylafenix/belief-network-irs
parsing_documents.py
9094e4cde738bd93ed1747dc958b5acb0e0fa684
__author__ = 'Jose Gabriel' import os import pprint def read_block(f): s = "" line = f.readline() while line and not line.startswith("."): s += line line = f.readline() return s, line def read_doc(f): doc = {"title": "", "authors": "", "content": ""} line ...
[((1448, 1468), 'os.mkdir', 'os.mkdir', (['out_folder'], {}), '(out_folder)\n', (1456, 1468), False, 'import os\n')]
caktus/rapidsms-groups
groups/admin.py
eda6f30cdc60cf57833f1d37ba08e59454da8987
#!/usr/bin/env python # vim: ai ts=4 sts=4 et sw=4 encoding=utf-8 from django.contrib import admin from groups.models import Group admin.site.register(Group)
[((134, 160), 'django.contrib.admin.site.register', 'admin.site.register', (['Group'], {}), '(Group)\n', (153, 160), False, 'from django.contrib import admin\n')]
Ascend-Huawei/AVOD
avod/datasets/kitti/kitti_aug_test.py
ea62372517bbfa9d4020bc5ab2739ee182c63c56
# Copyright 2017 The TensorFlow Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applica...
[((1490, 1563), 'numpy.array', 'np.array', (['[[1, 2, 3, 4, 5, 6, np.pi / 4], [1, 2, 3, 4, 5, 6, -np.pi / 4]]'], {}), '([[1, 2, 3, 4, 5, 6, np.pi / 4], [1, 2, 3, 4, 5, 6, -np.pi / 4]])\n', (1498, 1563), True, 'import numpy as np\n'), ((1630, 1718), 'numpy.array', 'np.array', (['[[-1, 2, 3, 4, 5, 6, 3 * np.pi / 4], [-1,...
keysona/blog
application/model/_base.py
783e0bdbed1e4d8ec9857ee609b39c9dfb958670
from flask_sqlalchemy import SQLAlchemy, Model # class BaseModel(Model): # def save(self): # db.session.add(self) # db.session.commit(self) # def delete(self): # db.session. db = SQLAlchemy()
[((195, 207), 'flask_sqlalchemy.SQLAlchemy', 'SQLAlchemy', ([], {}), '()\n', (205, 207), False, 'from flask_sqlalchemy import SQLAlchemy, Model\n')]
qianfei11/zstack-utility
kvmagent/kvmagent/plugins/prometheus.py
e791bc6b6ae3a74e202f6fce84bde498c715aee8
import os.path import threading import typing from prometheus_client import start_http_server from prometheus_client.core import GaugeMetricFamily, REGISTRY from kvmagent import kvmagent from zstacklib.utils import http from zstacklib.utils import jsonobject from zstacklib.utils import lock from zstacklib.utils impor...
[]
rockandsalt/conan-center-index
recipes/libstudxml/all/conanfile.py
d739adcec3e4dd4c250eff559ceb738e420673dd
from conans import ConanFile, AutoToolsBuildEnvironment, MSBuild, tools from conans.errors import ConanInvalidConfiguration import os import shutil required_conan_version = ">=1.33.0" class LibStudXmlConan(ConanFile): name = "libstudxml" description = "A streaming XML pull parser and streaming XML serializer...
[((1943, 2054), 'conans.tools.get', 'tools.get', ([], {'destination': 'self._source_subfolder', 'strip_root': '(True)'}), "(**self.conan_data['sources'][self.version], destination=self.\n _source_subfolder, strip_root=True)\n", (1952, 2054), False, 'from conans import ConanFile, AutoToolsBuildEnvironment, MSBuild, t...
KeleiHe/DAAN
dataset/WebCariA.py
04e153c55f8d63e824adbee828e524573afe6a1c
# Copyright 2020 Wen Ji & Kelei He (hkl@nju.edu.cn) # 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...
[((2214, 2255), 'os.path.join', 'os.path.join', (['self.dir_path', 'self.subPath'], {}), '(self.dir_path, self.subPath)\n', (2226, 2255), False, 'import os\n'), ((4759, 4792), 'os.path.join', 'os.path.join', (['self.dir_path', 'file'], {}), '(self.dir_path, file)\n', (4771, 4792), False, 'import os\n'), ((4833, 4868), ...
zomglings/moonworm
moonworm/crawler/state/json_state.py
930e60199629b6a04adecc7f9ff9450e51bb4640
import datetime import json import time from typing import Optional from web3.datastructures import AttributeDict from .event_scanner_state import EventScannerState class JSONifiedState(EventScannerState): """Store the state of scanned blocks and all events. All state is an in-memory dict. Simple load/...
[((1316, 1327), 'time.time', 'time.time', ([], {}), '()\n', (1325, 1327), False, 'import time\n'), ((1266, 1290), 'json.dump', 'json.dump', (['self.state', 'f'], {}), '(self.state, f)\n', (1275, 1290), False, 'import json\n'), ((2222, 2233), 'time.time', 'time.time', ([], {}), '()\n', (2231, 2233), False, 'import time\...
frahlg/npbench
npbench/benchmarks/nbody/nbody_dace.py
1bc4d9e2e22f3ca67fa2bc7f40e2e751a9c8dd26
# Adapted from https://github.com/pmocz/nbody-python/blob/master/nbody.py # TODO: Add GPL-3.0 License import numpy as np import dace as dc """ Create Your Own N-body Simulation (With Python) Philip Mocz (2020) Princeton Univeristy, @PMocz Simulate orbits of stars interacting due to gravity Code calculates pairwise for...
[((375, 403), 'dace.symbol', 'dc.symbol', (['s'], {'dtype': 'dc.int64'}), '(s, dtype=dc.int64)\n', (384, 403), True, 'import dace as dc\n'), ((1342, 1361), 'numpy.add.outer', 'np.add.outer', (['(-x)', 'x'], {}), '(-x, x)\n', (1354, 1361), True, 'import numpy as np\n'), ((1371, 1390), 'numpy.add.outer', 'np.add.outer', ...
Healthy-Kokoro/Hiroshima
application/__init__.py
87c6c533f97f55ceb33553a2409076bcd21a36d2
# Third-party imports from flask import Flask from flask_sqlalchemy import SQLAlchemy configurations = { 'development': 'configurations.DevelopmentConfiguration', 'testing': 'configurations.TestingConfiguration', 'staging': 'configurations.StagingConfiguration', 'production': 'configurations.ProductionConfiguratio...
[((337, 349), 'flask_sqlalchemy.SQLAlchemy', 'SQLAlchemy', ([], {}), '()\n', (347, 349), False, 'from flask_sqlalchemy import SQLAlchemy\n'), ((405, 451), 'flask.Flask', 'Flask', (['__name__'], {'instance_relative_config': '(True)'}), '(__name__, instance_relative_config=True)\n', (410, 451), False, 'from flask import ...
drednout/letspython
lesson5/exceptions_except.py
9747442d63873b5f71e2c15ed5528bd98ad5ac31
def take_beer(fridge, number=1): if "beer" not in fridge: raise Exception("No beer at all:(") if number > fridge["beer"]: raise Exception("Not enough beer:(") fridge["beer"] -= number if __name__ == "__main__": fridge = { "beer": 2, "milk": 1, "meat": 3, }...
[]
bhanupratapjain/icfs
icfs/filesystem/exceptions.py
44a2d5baadbc31bfebb931d713b426d22aabd969
class ICFSError(IOError): """Error while making any filesystem API requests."""
[]
juhovan/synapse
synapse/storage/data_stores/state/store.py
57feeab364325374b14ff67ac97c288983cc5cde
# -*- coding: utf-8 -*- # Copyright 2014-2016 OpenMarket Ltd # # 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 applicab...
[((1176, 1203), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (1193, 1203), False, 'import logging\n'), ((1266, 1328), 'collections.namedtuple', 'namedtuple', (['"""_GetStateGroupDelta"""', "('prev_group', 'delta_ids')"], {}), "('_GetStateGroupDelta', ('prev_group', 'delta_ids'))\n", (12...
manulangat1/djcommerce
core/migrations/0011_itemvariation_variation.py
2cd92631479ef949e0f05a255f2f50feca728802
# Generated by Django 2.2.6 on 2020-02-09 12:24 from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): dependencies = [ ('core', '0010_auto_20200130_1135'), ] operations = [ migrations.CreateModel( name='Variation', ...
[((363, 456), 'django.db.models.AutoField', 'models.AutoField', ([], {'auto_created': '(True)', 'primary_key': '(True)', 'serialize': '(False)', 'verbose_name': '"""ID"""'}), "(auto_created=True, primary_key=True, serialize=False,\n verbose_name='ID')\n", (379, 456), False, 'from django.db import migrations, models\...
Colins-Ford/mnist-webapp
mnist/convolutional.py
20e9b6f5520d5bda957d9501347f787450555db8
import os from mnist import model import tensorflow as tf from tensorflow.examples.tutorials.mnist import input_data data = input_data.read_data_sets("data/dataset/", one_hot=True) # model with tf.variable_scope("convolutional"): x = tf.placeholder(tf.float32, [None, 784]) keep_prob = tf.placeholder(tf.float...
[((126, 182), 'tensorflow.examples.tutorials.mnist.input_data.read_data_sets', 'input_data.read_data_sets', (['"""data/dataset/"""'], {'one_hot': '(True)'}), "('data/dataset/', one_hot=True)\n", (151, 182), False, 'from tensorflow.examples.tutorials.mnist import input_data\n'), ((391, 429), 'tensorflow.placeholder', 't...
nokout/au_address
parse_scripts/import_osm.py
07138ecd8fedab9566435b609cb8124b67ad42ff
import requests import codecs query1 = """<union> <query type="way"> <has-kv k="addr:housenumber"/> <has-kv k="addr:street:name"/> <has-kv k="addr:street:type"/> <has-kv k="addr:state"/> <bbox-query e="%s" n="%s" s="%s" w="%s"/> </query> <query type="way"> <has-kv k="addr:housenumber"/> <ha...
[((1389, 1458), 'requests.post', 'requests.post', (['"""http://overpass-api.de/api/interpreter/"""'], {'data': 'query1'}), "('http://overpass-api.de/api/interpreter/', data=query1)\n", (1402, 1458), False, 'import requests\n'), ((1486, 1547), 'codecs.open', 'codecs.open', (['"""data/osm_data.xml"""'], {'encoding': '"""...
abhirevan/pedestrian-detector
tools/test_net_batch.py
f4fa4cd59315ea515ace3c529b716ff3173e2205
#!/usr/bin/env python # -------------------------------------------------------- # Fast R-CNN # Copyright (c) 2015 Microsoft # Licensed under The MIT License [see LICENSE for details] # Written by Ross Girshick # -------------------------------------------------------- """Test a Fast R-CNN network on an image databas...
[((1074, 1147), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Test a Fast R-CNN network pipeline"""'}), "(description='Test a Fast R-CNN network pipeline')\n", (1097, 1147), False, 'import argparse\n'), ((2500, 2518), 'pprint.pprint', 'pprint.pprint', (['cfg'], {}), '(cfg)\n', (2513, 25...
mangowilliam/my_gallary
mygallary/urls.py
4c87fe055e5c28d6ca6a27ea5bde7df380750006
from django.conf import settings from django.conf.urls.static import static from django.conf.urls import url from . import views urlpatterns = [ url('^$', views.gallary,name = 'gallary'), url(r'^search/', views.search_image, name='search_image'), url(r'^details/(\d+)',views.search_location,name ='images'...
[((152, 192), 'django.conf.urls.url', 'url', (['"""^$"""', 'views.gallary'], {'name': '"""gallary"""'}), "('^$', views.gallary, name='gallary')\n", (155, 192), False, 'from django.conf.urls import url\n'), ((199, 255), 'django.conf.urls.url', 'url', (['"""^search/"""', 'views.search_image'], {'name': '"""search_image""...
ldelzott/ByteTrack
yolox/data/datasets/mot.py
5f8ab49a913a551d041918607a0bd2473602ad39
import cv2 import numpy as np from pycocotools.coco import COCO import os from ..dataloading import get_yolox_datadir from .datasets_wrapper import Dataset class MOTDataset(Dataset): """ COCO dataset class. """ def __init__( # This function is called in the exps yolox_x_mot17_half.py in this way: ...
[((3616, 3639), 'numpy.zeros', 'np.zeros', (['(num_objs, 6)'], {}), '((num_objs, 6))\n', (3624, 3639), True, 'import numpy as np\n'), ((4439, 4488), 'os.path.join', 'os.path.join', (['self.data_dir', 'self.name', 'file_name'], {}), '(self.data_dir, self.name, file_name)\n', (4451, 4488), False, 'import os\n'), ((4525, ...
pkoch/poetry
src/poetry/console/commands/remove.py
d22c5a7187d8b5a30196a7df58111b3c90be7d22
from __future__ import annotations from typing import Any from cleo.helpers import argument from cleo.helpers import option from tomlkit.toml_document import TOMLDocument try: from poetry.core.packages.dependency_group import MAIN_GROUP except ImportError: MAIN_GROUP = "default" from poetry.console.command...
[((513, 575), 'cleo.helpers.argument', 'argument', (['"""packages"""', '"""The packages to remove."""'], {'multiple': '(True)'}), "('packages', 'The packages to remove.', multiple=True)\n", (521, 575), False, 'from cleo.helpers import argument\n'), ((601, 677), 'cleo.helpers.option', 'option', (['"""group"""', '"""G"""...
orrinjelo/AdventOfCode2021
orrinjelo/aoc2021/day_11.py
6fce5c48ec3dc602b393824f592a5c6db2a8b66f
from orrinjelo.utils.decorators import timeit import numpy as np def parse(lines): return np.array([[int(c) for c in line.strip()] for line in lines]) visited = [] def flash(a, x, y): global visited if (x,y) in visited: return for dx in range(-1,2): for dy in range(-1,2): i...
[((886, 909), 'orrinjelo.utils.decorators.timeit', 'timeit', (['"""Day 11 Part 1"""'], {}), "('Day 11 Part 1')\n", (892, 909), False, 'from orrinjelo.utils.decorators import timeit\n'), ((1123, 1146), 'orrinjelo.utils.decorators.timeit', 'timeit', (['"""Day 11 Part 2"""'], {}), "('Day 11 Part 2')\n", (1129, 1146), Fals...
lukaszbinden/ethz-iacv-2020
exercise_2/exercise_2.1.py
271de804315de98b816cda3e2498958ffa87ad59
camera_width = 640 camera_height = 480 film_back_width = 1.417 film_back_height = 0.945 x_center = 320 y_center = 240 P_1 = (-0.023, -0.261, 2.376) p_11 = P_1[0] p_12 = P_1[1] p_13 = P_1[2] P_2 = (0.659, -0.071, 2.082) p_21 = P_2[0] p_22 = P_2[1] p_23 = P_2[2] p_1_prime = (52, 163) x_1 = p_1_prime[0] y_1 = p_1_pr...
[]
paper2code/torch2vec-restful-service
services/train/single.py
6c4412d84d067268bf988b1f31cef716a2ed23a5
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Wed Aug 26 19:15:34 2020 @author: deviantpadam """ import pandas as pd import numpy as np import concurrent.futures import os import tqdm from collections import Counter from torch2vec.data import DataPreparation from torch2vec.torch2vec import DM # train ...
[((471, 526), 'pandas.read_csv', 'pd.read_csv', (['"""../data/suggest_dump.txt"""'], {'delimiter': '"""\t"""'}), "('../data/suggest_dump.txt', delimiter='\\t')\n", (482, 526), True, 'import pandas as pd\n'), ((1182, 1267), 'pandas.concat', 'pd.concat', (["[train['subject1'], train['subject2'], train['task'], corpus]"],...
geo-bl-ch/pyramid_oereb
tests/sources/test_document_oereblex.py
767375a4adda4589e12c4257377fc30258cdfcb3
# -*- coding: utf-8 -*- import datetime import pytest import requests_mock from geolink_formatter.entity import Document, File from requests.auth import HTTPBasicAuth from pyramid_oereb.contrib.sources.document import OEREBlexSource from pyramid_oereb.lib.records.documents import DocumentRecord, LegalProvisionRecord...
[((426, 765), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""valid,cfg"""', "[(True, {'host': 'http://oereblex.example.com', 'language': 'de', 'canton':\n 'BL'}), (False, {'language': 'de', 'canton': 'BL'}), (False, {'host':\n 'http://oereblex.example.com', 'language': 'german', 'canton': 'BL'}),\n ...
codecat555/codecat555-fidgetingbits_knausj_talon
apps/zsh/singletons.py
62f9be0459e6631c99d58eee97054ddd970cc5f3
# A rarely-updated module to assist in writing reload-safe talon modules using # things like threads, which are not normally safe for reloading with talon. # If this file is ever updated, you'll need to restart talon. import logging _singletons = {} def singleton(fn): name = f"{fn.__module__}.{fn.__name__}" ...
[((531, 608), 'logging.error', 'logging.error', (['f"""the old @singleton function {name} had more than one yield!"""'], {}), "(f'the old @singleton function {name} had more than one yield!')\n", (544, 608), False, 'import logging\n')]
yztxwd/Bichrom
trainNN/run_bichrom.py
3939b8e52816a02b34122feef27c8e0a06e31d8e
import argparse import yaml from subprocess import call from train import train_bichrom if __name__ == '__main__': # parsing parser = argparse.ArgumentParser(description='Train and Evaluate Bichrom') parser.add_argument('-training_schema_yaml', required=True, help='YAML file with pa...
[((143, 208), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Train and Evaluate Bichrom"""'}), "(description='Train and Evaluate Bichrom')\n", (166, 208), False, 'import argparse\n'), ((937, 960), 'subprocess.call', 'call', (["['mkdir', outdir]"], {}), "(['mkdir', outdir])\n", (941, 960)...
Fronius-SED/rapidyaml
setup.py
20d44ff0c43085d08cb17f37fd6b0b305938a3ea
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # SPDX-License-Identifier: MIT import os import shutil import sys from pathlib import Path from distutils import log from setuptools import setup from setuptools.command.sdist import sdist as SdistCommand from cmake_build_extension import BuildExtension, CMakeExtension ...
[((528, 574), 'os.path.join', 'os.path.join', (['PYTHON_DIR', '"""ryml"""', '"""version.py"""'], {}), "(PYTHON_DIR, 'ryml', 'version.py')\n", (540, 574), False, 'import os\n'), ((3069, 3496), 'setuptools.setup', 'setup', ([], {'name': '"""rapidyaml"""', 'description': '"""Rapid YAML - a library to parse and emit YAML, ...
machdyne/litex-boards
litex_boards/targets/digilent_arty_z7.py
2311db18f8c92f80f03226fa984e6110caf25b88
#!/usr/bin/env python3 # # This file is part of LiteX-Boards. # # Copyright (c) 2021 Gwenhael Goavec-Merou <gwenhael.goavec-merou@trabucayre.com> # SPDX-License-Identifier: BSD-2-Clause import argparse import subprocess from migen import * from litex_boards.platforms import digilent_arty_z7 from litex.build import ...
[((3915, 3974), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""LiteX SoC on Arty Z7"""'}), "(description='LiteX SoC on Arty Z7')\n", (3938, 3974), False, 'import argparse\n'), ((4527, 4552), 'litex.build.xilinx.vivado.vivado_build_args', 'vivado_build_args', (['parser'], {}), '(parser)\n...
allmalaysianews/article-extractor
goose/parsers.py
8d0ff3ed01258d0fad56fc22d2c1852e603096b4
# -*- coding: utf-8 -*- """\ This is a python port of "Goose" orignialy licensed to Gravity.com under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. Python port was written by Xavier Grangier for Recrutae Gravity.co...
[((1646, 1663), 'goose.text.encodeValue', 'encodeValue', (['html'], {}), '(html)\n', (1657, 1663), False, 'from goose.text import encodeValue\n'), ((1683, 1708), 'lxml.html.fromstring', 'lxmlhtml.fromstring', (['html'], {}), '(html)\n', (1702, 1708), True, 'import lxml.html as lxmlhtml\n'), ((1800, 1820), 'lxml.etree.t...
SoyBeansLab/daizu-online-judge-backend
src/infrastructure/database/postgres/sqlhandler.py
873f81fdad2f216e28b83341a6d88b0e21078d6e
from logging import getLogger import os from typing import List, Union import psycopg2 from interface.database.sqlhandler import Cursor as AbsCursor from interface.database.sqlhandler import Result as AbsResult from interface.database.sqlhandler import SqlHandler as AbsSqlHandler from exceptions.waf import SqlTransa...
[((346, 364), 'logging.getLogger', 'getLogger', (['"""daizu"""'], {}), "('daizu')\n", (355, 364), False, 'from logging import getLogger\n'), ((922, 967), 'os.getenv', 'os.getenv', (['"""DAIZU_DATABASE_HOST"""', '"""localhost"""'], {}), "('DAIZU_DATABASE_HOST', 'localhost')\n", (931, 967), False, 'import os\n'), ((990, ...
CityPulse/CP_Resourcemanagement
virtualisation/wrapper/parser/xmlparser.py
aa670fa89d5e086a98ade3ccc152518be55abf2e
from virtualisation.clock.abstractclock import AbstractClock __author__ = 'Marten Fischer (m.fischer@hs-osnabrueck.de)' from virtualisation.wrapper.parser.abstractparser import AbstractParser from virtualisation.misc.jsonobject import JSONObject as JOb import datetime as dt class XMLParser(AbstractParser): """ ...
[]
jonathan-greig/plaso
plaso/formatters/interface.py
b88a6e54c06a162295d09b016bddbfbfe7ca9070
# -*- coding: utf-8 -*- """This file contains the event formatters interface classes. The l2t_csv and other formats are dependent on a message field, referred to as description_long and description_short in l2t_csv. Plaso no longer stores these field explicitly. A formatter, with a format string definition, is used ...
[((6576, 6631), 're.compile', 're.compile', (['"""{([a-z][a-zA-Z0-9_]*)[!]?[^:}]*[:]?[^}]*}"""'], {}), "('{([a-z][a-zA-Z0-9_]*)[!]?[^:}]*[:]?[^}]*}')\n", (6586, 6631), False, 'import re\n'), ((8178, 8205), 'plaso.formatters.logger.error', 'logger.error', (['error_message'], {}), '(error_message)\n', (8190, 8205), False...
LiuKaiqiang94/PyStudyExample
python_program/condition.py
b30212718b218c71e06b68677f55c33e3a1dbf46
def main(): val=int(input("input a num")) if val<10: print("A") elif val<20: print("B") elif val<30: print("C") else: print("D") main()
[]
Rukaume/LRCN
Annotated_video/test/Annotatedvideo_worm.py
0d1928cc72544f59a4335fea7febc561d3dfc118
# -*- coding: utf-8 -*- """ Created on Fri Sep 4 22:27:11 2020 @author: Miyazaki """ imdir = "C:/Users/Miyazaki/Desktop/hayashi_lab/20200527_lethargus_analysis/renamed_pillar_chamber-N2/chamber3" resultdir= "C:/Users/Miyazaki/Desktop/hayashi_lab/20200527_lethargus_analysis/renamed_pillar_chamber-N2/result0918.csv" i...
[((386, 401), 'os.chdir', 'os.chdir', (['imdir'], {}), '(imdir)\n', (394, 401), False, 'import os, cv2, shutil\n'), ((402, 450), 'os.makedirs', 'os.makedirs', (['"""../annotatedimages"""'], {'exist_ok': '(True)'}), "('../annotatedimages', exist_ok=True)\n", (413, 450), False, 'import os, cv2, shutil\n'), ((464, 480), '...
masterisira/ELIZA_OF-master
emilia/modules/math.py
02a7dbf48e4a3d4ee0981e6a074529ab1497aafe
from typing import List import requests from telegram import Message, Update, Bot, MessageEntity from telegram.ext import CommandHandler, run_async from emilia import dispatcher from emilia.modules.disable import DisableAbleCommandHandler from emilia.modules.helper_funcs.alternate import send_message import pynewtonmat...
[((3826, 3885), 'emilia.modules.disable.DisableAbleCommandHandler', 'DisableAbleCommandHandler', (['"""math"""', 'simplify'], {'pass_args': '(True)'}), "('math', simplify, pass_args=True)\n", (3851, 3885), False, 'from emilia.modules.disable import DisableAbleCommandHandler\n'), ((3903, 3962), 'emilia.modules.disable.D...
matteobjornsson/serverless-rock-paper-scissors
services/IAm.py
32b6f11644c59dc3bb159ee9e1118fed26a3983d
# # Created on Thu Apr 22 2021 # Matteo Bjornsson # import boto3 from botocore.exceptions import ClientError import logging logging.basicConfig(filename="rps.log", level=logging.INFO) iam_resource = boto3.resource("iam") sts_client = boto3.client("sts") def create_role( iam_role_name: str, assume_role_policy_js...
[((125, 184), 'logging.basicConfig', 'logging.basicConfig', ([], {'filename': '"""rps.log"""', 'level': 'logging.INFO'}), "(filename='rps.log', level=logging.INFO)\n", (144, 184), False, 'import logging\n'), ((201, 222), 'boto3.resource', 'boto3.resource', (['"""iam"""'], {}), "('iam')\n", (215, 222), False, 'import bo...
babatana/stograde
stograde/common/run_status.py
c1c447e99c44c23cef9dd857e669861f3708ae77
from enum import auto, Enum class RunStatus(Enum): SUCCESS = auto() CALLED_PROCESS_ERROR = auto() FILE_NOT_FOUND = auto() PROCESS_LOOKUP_ERROR = auto() TIMEOUT_EXPIRED = auto()
[((67, 73), 'enum.auto', 'auto', ([], {}), '()\n', (71, 73), False, 'from enum import auto, Enum\n'), ((101, 107), 'enum.auto', 'auto', ([], {}), '()\n', (105, 107), False, 'from enum import auto, Enum\n'), ((129, 135), 'enum.auto', 'auto', ([], {}), '()\n', (133, 135), False, 'from enum import auto, Enum\n'), ((163, 1...
shenghuiliuu/recsys
recsys/__init__.py
d706d1ae2558816c1e11ca790baeb7748200b404
__all__ = ['cross_validation', 'metrics', 'datasets', 'recommender']
[]
CostanzoPablo/audiomate
audiomate/annotations/label_list.py
080402eadaa81f77f64c8680510a2de64bc18e74
import collections import copy import intervaltree from .label import Label class LabelList: """ Represents a list of labels which describe an utterance. An utterance can have multiple label-lists. Args: idx (str): An unique identifier for the label-list within a corpus f...
[((1013, 1040), 'intervaltree.IntervalTree', 'intervaltree.IntervalTree', ([], {}), '()\n', (1038, 1040), False, 'import intervaltree\n'), ((7210, 7240), 'collections.defaultdict', 'collections.defaultdict', (['float'], {}), '(float)\n', (7233, 7240), False, 'import collections\n'), ((8603, 8631), 'collections.defaultd...
RubyMarsden/Crayfish
src/views/age_results_widget.py
33bbb1248beec2fc40eee59e462711dd8cbc33da
import matplotlib from PyQt5.QtCore import Qt from PyQt5.QtWidgets import QHBoxLayout, QDialog, QPushButton, QWidget, QVBoxLayout, QLabel matplotlib.use('QT5Agg') import matplotlib.pyplot as plt from models.data_key import DataKey from utils import ui_utils class AgeResultsWidget(QWidget): def __init__(self, re...
[((139, 163), 'matplotlib.use', 'matplotlib.use', (['"""QT5Agg"""'], {}), "('QT5Agg')\n", (153, 163), False, 'import matplotlib\n'), ((343, 365), 'PyQt5.QtWidgets.QWidget.__init__', 'QWidget.__init__', (['self'], {}), '(self)\n', (359, 365), False, 'from PyQt5.QtWidgets import QHBoxLayout, QDialog, QPushButton, QWidget...
EnergyModels/OCAES
examples/single_run/ocaes_single_run.py
d848d9fa621767e036824110de87450d524b7687
import pandas as pd from OCAES import ocaes # ---------------------- # create and run model # ---------------------- data = pd.read_csv('timeseries_inputs_2019.csv') inputs = ocaes.get_default_inputs() # inputs['C_well'] = 5000.0 # inputs['X_well'] = 50.0 # inputs['L_well'] = 50.0 # inputs['X_cmp'] = 0 # inputs['X_exp...
[((125, 166), 'pandas.read_csv', 'pd.read_csv', (['"""timeseries_inputs_2019.csv"""'], {}), "('timeseries_inputs_2019.csv')\n", (136, 166), True, 'import pandas as pd\n'), ((176, 202), 'OCAES.ocaes.get_default_inputs', 'ocaes.get_default_inputs', ([], {}), '()\n', (200, 202), False, 'from OCAES import ocaes\n'), ((335,...
am-ivanov/dace
tests/transformations/local_storage_test.py
c35f0b3cecc04a2c9fb668bd42a72045891e7a42
import unittest import dace import numpy as np from dace.transformation.dataflow import MapTiling, OutLocalStorage N = dace.symbol('N') @dace.program def arange(): out = np.ndarray([N], np.int32) for i in dace.map[0:N]: with dace.tasklet: o >> out[i] o = i return out cla...
[((120, 136), 'dace.symbol', 'dace.symbol', (['"""N"""'], {}), "('N')\n", (131, 136), False, 'import dace\n'), ((177, 202), 'numpy.ndarray', 'np.ndarray', (['[N]', 'np.int32'], {}), '([N], np.int32)\n', (187, 202), True, 'import numpy as np\n'), ((1422, 1437), 'unittest.main', 'unittest.main', ([], {}), '()\n', (1435, ...
jayvdb/astropy
astropy/io/fits/hdu/streaming.py
bc6d8f106dd5b60bf57a8e6e29c4e2ae2178991f
# Licensed under a 3-clause BSD style license - see PYFITS.rst import gzip import os from .base import _BaseHDU, BITPIX2DTYPE from .hdulist import HDUList from .image import PrimaryHDU from astropy.io.fits.file import _File from astropy.io.fits.header import _pad_length from astropy.io.fits.util import fileobj_name ...
[((3970, 3991), 'astropy.io.fits.file._File', '_File', (['name', '"""append"""'], {}), "(name, 'append')\n", (3975, 3991), False, 'from astropy.io.fits.file import _File\n'), ((2345, 2363), 'astropy.io.fits.util.fileobj_name', 'fileobj_name', (['name'], {}), '(name)\n', (2357, 2363), False, 'from astropy.io.fits.util i...
groupe-conseil-nutshimit-nippour/django-geoprisma
geoprisma/tests/test_templatetags.py
4732fdb8a0684eb4d7fd50aa43e11b454ee71d08
import django from django.test import TestCase from django.template import Template, Context class genericObj(object): """ A generic object for testing templatetags """ def __init__(self): self.name = "test" self.status = "ready" def getOption(self, optionName): ...
[((685, 706), 'django.template.Context', 'Context', (['context_dict'], {}), '(context_dict)\n', (692, 706), False, 'from django.template import Template, Context\n'), ((716, 741), 'django.template.Template', 'Template', (['template_string'], {}), '(template_string)\n', (724, 741), False, 'from django.template import Te...
acidburn0zzz/ggrc-core
src/ggrc_workflows/models/task_group.py
386781d08172102eb51030b65db8212974651628
# Copyright (C) 2016 Google Inc. # Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file> """A module containing the workflow TaskGroup model.""" from sqlalchemy import or_ from ggrc import db from ggrc.login import get_current_user from ggrc.models.associationproxy import association_proxy fr...
[((1004, 1095), 'ggrc.db.relationship', 'db.relationship', (['"""TaskGroupObject"""'], {'backref': '"""task_group"""', 'cascade': '"""all, delete-orphan"""'}), "('TaskGroupObject', backref='task_group', cascade=\n 'all, delete-orphan')\n", (1019, 1095), False, 'from ggrc import db\n'), ((1111, 1179), 'ggrc.models.as...
DanielNoord/DuolingoPomodoro
src/tests/app_functions/menu/test_change_auto_login.py
307b386daf3216fb9ba86f983f0e39f6647ffd64
import pytest import rumps from src.app_functions.menu.change_auto_login import change_auto_login @pytest.fixture(name="basic_app") def create_app(): """Creates a basic app object with some variables to pass to functions Returns: rumps.App: Basic app """ app = rumps.App("TestApp") app.set...
[((101, 133), 'pytest.fixture', 'pytest.fixture', ([], {'name': '"""basic_app"""'}), "(name='basic_app')\n", (115, 133), False, 'import pytest\n'), ((288, 308), 'rumps.App', 'rumps.App', (['"""TestApp"""'], {}), "('TestApp')\n", (297, 308), False, 'import rumps\n'), ((661, 689), 'src.app_functions.menu.change_auto_logi...
H0merJayS1mpson/deepobscustom
deepobs/tensorflow/testproblems/cifar100_vgg19.py
e85816ce42466326dac18841c58b79f87a4a1a7c
# -*- coding: utf-8 -*- """VGG 19 architecture for CIFAR-100.""" import tensorflow as tf from ._vgg import _vgg from ..datasets.cifar100 import cifar100 from .testproblem import TestProblem class cifar100_vgg19(TestProblem): """DeepOBS test problem class for the VGG 19 network on Cifar-100. The CIFAR-100 ima...
[((2453, 2490), 'tensorflow.equal', 'tf.equal', (['self.dataset.phase', '"""train"""'], {}), "(self.dataset.phase, 'train')\n", (2461, 2490), True, 'import tensorflow as tf\n'), ((2724, 2799), 'tensorflow.nn.softmax_cross_entropy_with_logits_v2', 'tf.nn.softmax_cross_entropy_with_logits_v2', ([], {'labels': 'y', 'logit...
TheHumanGoogle/Hackerrank-python-solution
write-a-function.py
ab2fa515444d7493340d7c7fbb88c3a090a3a8f5
def is_leap(year): leap=False if year%400==0: leap=True elif year%4==0 and year%100!=0: leap=True else: leap=False return leap year = int(input())
[]
byshyk/shortio
shortio/utils.py
054014b3936495c86d2e2cd6a61c3cee9ab9b0f2
"""Contains utility functions.""" BIN_MODE_ARGS = {'mode', 'buffering', } TEXT_MODE_ARGS = {'mode', 'buffering', 'encoding', 'errors', 'newline'} def split_args(args): """Splits args into two groups: open args and other args. Open args are used by ``open`` function. Other args are used by ``load``/``dum...
[]
sobolevn/paasta
paasta_tools/async_utils.py
8b87e0b13816c09b3d063b6d3271e6c7627fd264
import asyncio import functools import time import weakref from collections import defaultdict from typing import AsyncIterable from typing import Awaitable from typing import Callable from typing import Dict from typing import List from typing import Optional from typing import TypeVar T = TypeVar("T") # NOTE: thi...
[((294, 306), 'typing.TypeVar', 'TypeVar', (['"""T"""'], {}), "('T')\n", (301, 306), False, 'from typing import TypeVar\n'), ((1062, 1116), 'functools._make_key', 'functools._make_key', (['args_for_key', 'kwargs'], {'typed': '(False)'}), '(args_for_key, kwargs, typed=False)\n', (1081, 1116), False, 'import functools\n'...
MTI830PyTraders/pytrade
util/dataset.py
33ea3e756019c999e9c3d78fca89cd72addf6ab2
#!/usr/bin/python ''' generate dataset ''' import csv import argparse import numpy as np import sklearn.metrics import theanets from sklearn.metrics import accuracy_score import logging from trendStrategy import OptTrendStrategy, TrendStrategy from util import visu def compare(stock, field='orders', strategy="TrendSt...
[]
manvhah/sporco
examples/scripts/sc/bpdn.py
9237d7fc37e75089a2a65ebfe02b7491410da7d4
#!/usr/bin/env python # -*- coding: utf-8 -*- # This file is part of the SPORCO package. Details of the copyright # and user license can be found in the 'LICENSE.txt' file distributed # with the package. """ Basis Pursuit DeNoising ======================= This example demonstrates the use of class :class:`.admm.bpdn....
[((1417, 1438), 'numpy.random.seed', 'np.random.seed', (['(12345)'], {}), '(12345)\n', (1431, 1438), True, 'import numpy as np\n'), ((1443, 1464), 'numpy.random.randn', 'np.random.randn', (['N', 'M'], {}), '(N, M)\n', (1458, 1464), True, 'import numpy as np\n'), ((1470, 1486), 'numpy.zeros', 'np.zeros', (['(M, 1)'], {}...
tadartefactorist/mask
saleor-env/lib/python3.7/site-packages/snowballstemmer/nepali_stemmer.py
7967dd4ad39e3d26ac516719faefb40e00a8cbff
# This file was generated automatically by the Snowball to Python compiler # http://snowballstem.org/ from .basestemmer import BaseStemmer from .among import Among class NepaliStemmer(BaseStemmer): ''' This class was automatically generated by a Snowball to Python compiler It implements the stemming algo...
[]
MountainField/uspec
tests/auto_test_class_creation_spec.py
a4f8908b1a3af519d9d2ce7b85a4b4cca7b85883
# -*- coding: utf-8 -*- # ================================================================= # uspec # # Copyright (c) 2020 Takahide Nogayama # # This software is released under the MIT License. # http://opensource.org/licenses/mit-license.php # ================================================================= from __...
[((534, 571), 'uspec.describe', 'describe', (['"""Game"""'], {'test_class': 'TestGame'}), "('Game', test_class=TestGame)\n", (542, 571), False, 'from uspec import describe, context, it\n'), ((622, 632), 'uspec.it', 'it', (['"""hoge"""'], {}), "('hoge')\n", (624, 632), False, 'from uspec import describe, context, it\n')...
Matthewk01/Snake-AI
main.py
d5f211334436676966f17bb6dbfea8aba61ee6b4
import pygame from game.game_logic.game import Game import matplotlib.pyplot as plt def main(): scores_history = [] GAME_COUNT = 2 for i in range(GAME_COUNT): game = Game(400, "Snake AI") score = game.start() scores_history.append(score) print("Game:", i) plt.ylim(0, 3...
[((307, 322), 'matplotlib.pyplot.ylim', 'plt.ylim', (['(0)', '(36)'], {}), '(0, 36)\n', (315, 322), True, 'import matplotlib.pyplot as plt\n'), ((384, 410), 'matplotlib.pyplot.ylabel', 'plt.ylabel', (['"""Snake length"""'], {}), "('Snake length')\n", (394, 410), True, 'import matplotlib.pyplot as plt\n'), ((415, 439), ...
ctuning/inference_results_v1.1
closed/Intel/code/resnet50/openvino-cpu/src/tools/create_image_list.py
d9176eca28fcf6d7a05ccb97994362a76a1eb5ab
import os import sys from glob import glob def create_list(images_dir, output_file, img_ext=".jpg"): ImgList = os.listdir(images_dir) val_list = [] for img in ImgList: img,ext = img.split(".") val_list.append(img) with open(os.path.join(images_dir, output_file),'w') as fid: ...
[((117, 139), 'os.listdir', 'os.listdir', (['images_dir'], {}), '(images_dir)\n', (127, 139), False, 'import os\n'), ((521, 532), 'sys.exit', 'sys.exit', (['(1)'], {}), '(1)\n', (529, 532), False, 'import sys\n'), ((265, 302), 'os.path.join', 'os.path.join', (['images_dir', 'output_file'], {}), '(images_dir, output_fil...
honchardev/Fun
AI/others/churn/churn_2.py
ca7c0076e9bb3017c5d7e89aa7d5bd54a83c8ecc
#!/usr/bin/env python # coding: utf-8 # In[1]: # src: http://datareview.info/article/prognozirovanie-ottoka-klientov-so-scikit-learn/ # In[ ]: # Показатель оттока клиентов – бизнес-термин, описывающий # насколько интенсивно клиенты покидают компанию или # прекращают оплачивать товары или услуги. # Это ключевой ...
[((1752, 1776), 'pandas.read_csv', 'pd.read_csv', (['"""churn.csv"""'], {}), "('churn.csv')\n", (1763, 1776), True, 'import pandas as pd\n'), ((2422, 2452), 'sklearn.preprocessing.StandardScaler', 'StandardScaler', ([], {'with_mean': '(True)'}), '(with_mean=True)\n', (2436, 2452), False, 'from sklearn.preprocessing imp...
rajatariya21/airbyte
airbyte-integrations/connectors/source-google-sheets/google_sheets_source/models/spreadsheet.py
11e70a7a96e2682b479afbe6f709b9a5fe9c4a8d
# MIT License # # Copyright (c) 2020 Airbyte # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights # to use, copy, modify, merge, publ...
[]
Dnewman9/Python-Trivia-API
pytrivia/trivia.py
0af7f999cc4ab278fb0ac6fd64733ab168984e60
""" A simple python api wrapper for https://opentdb.com/ """ from aiohttp import ClientSession from requests import get from pytrivia.__helpers import decode_dict, get_token, make_request from pytrivia.enums import * class Trivia: def __init__(self, with_token: bool): """ Initialize an instance ...
[((452, 463), 'pytrivia.__helpers.get_token', 'get_token', ([], {}), '()\n', (461, 463), False, 'from pytrivia.__helpers import decode_dict, get_token, make_request\n'), ((1575, 1586), 'pytrivia.__helpers.get_token', 'get_token', ([], {}), '()\n', (1584, 1586), False, 'from pytrivia.__helpers import decode_dict, get_to...
py-ranoid/practical-nlp
utils.py
514fd4da3b72f26597d91cdb89704a849bf6b36d
import requests import tarfile import os def download_file(url, directory): local_filename = os.path.join(directory, url.split('/')[-1]) print ("Downloading %s --> %s"%(url, local_filename)) with requests.get(url, stream=True) as r: r.raise_for_status() with open(local_filename, 'wb') as f:...
[((484, 504), 'os.path.split', 'os.path.split', (['fpath'], {}), '(fpath)\n', (497, 504), False, 'import os\n'), ((962, 980), 'os.walk', 'os.walk', (['startpath'], {}), '(startpath)\n', (969, 980), False, 'import os\n'), ((209, 239), 'requests.get', 'requests.get', (['url'], {'stream': '(True)'}), '(url, stream=True)\n...
yostudios/Spritemapper
spritecss/config.py
277cb76a14be639b6d7fa3191bc427409e72ad69
import shlex from os import path from itertools import imap, ifilter from urlparse import urljoin from .css import CSSParser, iter_events def parse_config_stmt(line, prefix="spritemapper."): line = line.strip() if line.startswith(prefix) and "=" in line: (key, value) = line.split("=", 1) return...
[]
DanielTakeshi/debridement-code
plotting/make_bar_graph.py
d1a946d1fa3c60b60284c977ecb2d6584e524ae2
""" A bar graph. (c) September 2017 by Daniel Seita """ import argparse from collections import defaultdict from keras.models import Sequential from keras.layers import Dense, Activation import matplotlib matplotlib.use('Agg') import matplotlib.pyplot as plt import numpy as np import sys np.set_printoptions(suppress=...
[((207, 228), 'matplotlib.use', 'matplotlib.use', (['"""Agg"""'], {}), "('Agg')\n", (221, 228), False, 'import matplotlib\n'), ((291, 340), 'numpy.set_printoptions', 'np.set_printoptions', ([], {'suppress': '(True)', 'linewidth': '(200)'}), '(suppress=True, linewidth=200)\n', (310, 340), True, 'import numpy as np\n'), ...
tzengerink/groceries-api
setup.py
a22cc3503006b87b731b956f6341d730b143bf10
#!/usr/bin/env python from setuptools import find_packages, setup import os import re ROOT = os.path.dirname(__file__) VERSION_RE = re.compile(r'''__version__ = \'([0-9.]+)\'''') def get_version(): init = open(os.path.join(ROOT, 'application', '__init__.py')).read() return VERSION_RE.search(init).group(1) ...
[((95, 120), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (110, 120), False, 'import os\n'), ((134, 177), 're.compile', 're.compile', (['"""__version__ = \\\\\'([0-9.]+)\\\\\'"""'], {}), '("__version__ = \\\\\'([0-9.]+)\\\\\'")\n', (144, 177), False, 'import re\n'), ((413, 428), 'setuptools...
SuperM0use24/TT-CL-Edition
toontown/suit/DistributedLawbotBoss.py
fdad8394f0656ae122b687d603f72afafd220c65
from direct.showbase.ShowBase import * from direct.interval.IntervalGlobal import * from toontown.battle.BattleProps import * from direct.distributed.ClockDelta import * from direct.showbase.PythonUtil import Functor from direct.showbase.PythonUtil import StackTrace from direct.gui.DirectGui import * from panda3d.core ...
[]
lightmatter-ai/tensorflow-onnx
tests/test_custom_rnncell.py
a08aa32e211b859e8a437c5d8a822ea55c46e7c6
# SPDX-License-Identifier: Apache-2.0 """Unit Tests for custom rnns.""" from __future__ import absolute_import from __future__ import division from __future__ import print_function import numpy as np import tensorflow as tf from tensorflow.python.ops import init_ops from backend_test_base import Tf2OnnxBackendTest...
[((584, 592), 'tf2onnx.tf_loader.is_tf2', 'is_tf2', ([], {}), '()\n', (590, 592), False, 'from tf2onnx.tf_loader import is_tf2\n'), ((1563, 1627), 'numpy.array', 'np.array', (['[[1.0, 1.0], [2.0, 2.0], [3.0, 3.0]]'], {'dtype': 'np.float32'}), '([[1.0, 1.0], [2.0, 2.0], [3.0, 3.0]], dtype=np.float32)\n', (1571, 1627), T...
noname34/CHARM_Project_Hazard_Perception_I
cookie-cutter/src/templates/template.py
2d03d9e8911afad21818c6f837558503508a59bd
#!/user/bin/env python3 # -*- coding: utf-8 -*- #!/user/bin/env python3 # -*- coding: utf-8 -*- # @Author: Kevin Bürgisser # @Email: kevin.buergisser@edu.hefr.ch # @Date: 04.2020 # Context: CHARM PROJECT - Harzard perception """ Module documentation. """ # Imports import sys #import os # Global variables # Class...
[((474, 485), 'sys.exit', 'sys.exit', (['(1)'], {}), '(1)\n', (482, 485), False, 'import sys\n')]
siwill22/magSA
utils/gridpeak.py
9f3a12e6ed971d67444804cad57734dc0b4772ff
import numpy def gridpeak(t, X=None): # GP = GRIDPEAK(...) # gp = gridpeak(t) return gridpeaks based on Blakely # and Simpson method # gp = gridpeak(t,X) optionally remove peak values scoring less than X, # where X can be between 1 and 4. print 'shape ', t.shap...
[]