repo_name stringlengths 7 94 | repo_path stringlengths 4 237 | repo_head_hexsha stringlengths 40 40 | content stringlengths 10 680k | apis stringlengths 2 680k |
|---|---|---|---|---|
Tranquant/tqcli | tqcli/config/config.py | 0cc12e0d80129a14cec8117cd73e2ca69fb25214 | import logging
from os.path import expanduser
#TQ_API_ROOT_URL = 'http://127.0.1.1:8090/dataset'
TQ_API_ROOT_URL = 'http://elb-tranquant-ecs-cluster-tqapi-1919110681.us-west-2.elb.amazonaws.com/dataset'
LOG_PATH = expanduser('~/tqcli.log')
# the chunk size must be at least 5MB for multipart upload
DEFAULT_CHUNK_SIZE ... | [((215, 240), 'os.path.expanduser', 'expanduser', (['"""~/tqcli.log"""'], {}), "('~/tqcli.log')\n", (225, 240), False, 'from os.path import expanduser\n'), ((346, 492), 'logging.basicConfig', 'logging.basicConfig', ([], {'level': 'logging.DEBUG', 'format': '"""%(asctime)s - %(name)s - %(levelname)s - %(message)s"""', '... |
rainwangphy/fqf-iqn-qrdqn.pytorch | fqf_iqn_qrdqn/agent/base_agent.py | 351e9c4722c8b1ed411cd8c1bbf46c93c07f0893 | from abc import ABC, abstractmethod
import os
import numpy as np
import torch
from torch.utils.tensorboard import SummaryWriter
from fqf_iqn_qrdqn.memory import LazyMultiStepMemory, \
LazyPrioritizedMultiStepMemory
from fqf_iqn_qrdqn.utils import RunningMeanStats, LinearAnneaer
class BaseAgent(ABC):
def __i... | [((966, 989), 'torch.manual_seed', 'torch.manual_seed', (['seed'], {}), '(seed)\n', (983, 989), False, 'import torch\n'), ((998, 1018), 'numpy.random.seed', 'np.random.seed', (['seed'], {}), '(seed)\n', (1012, 1018), True, 'import numpy as np\n'), ((2004, 2034), 'os.path.join', 'os.path.join', (['log_dir', '"""model"""... |
felaray/Recognizers-Text | Python/libraries/recognizers-date-time/recognizers_date_time/date_time/italian/timeperiod_extractor_config.py | f514fd61c8d472ed92565261162712409f655312 | # Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.
from typing import List, Pattern
from recognizers_text.utilities import RegExpUtility
from recognizers_text.extractor import Extractor
from recognizers_number.number.italian.extractors import ItalianIntegerExtractor
from .... | [((2169, 2194), 'recognizers_number.number.italian.extractors.ItalianIntegerExtractor', 'ItalianIntegerExtractor', ([], {}), '()\n', (2192, 2194), False, 'from recognizers_number.number.italian.extractors import ItalianIntegerExtractor\n'), ((2661, 2718), 'recognizers_text.utilities.RegExpUtility.get_safe_reg_exp', 'Re... |
BotanyHunter/QuartetAnalysis | quartet_condor.py | c9b21aac267718be5ea8a8a76632fc0a3feb8403 | #quartet_condor.py
#version 2.0.2
import random, sys
def addToDict(d):
'''
Ensures each quartet has three concordance factors (CFs)
a dictionary d has less than three CFs, add CFs with the value 0 until there are three
Input: a dictionary containing CFs, a counter of how many CFs are in the dictionar... | [((1227, 1254), 'random.randint', 'random.randint', (['(0)', '(ntax - 1)'], {}), '(0, ntax - 1)\n', (1241, 1254), False, 'import random, sys\n')] |
rahulroshan96/CloudVisual | src/profiles/forms.py | aa33709d88442bcdbe3229234b4eb4f9abb4481e | from django import forms
from models import UserInputModel
class UserInputForm(forms.ModelForm):
class Meta:
model = UserInputModel
fields = ['user_input'] | [] |
Honny1/oval-graph | tests_oval_graph/test_arf_xml_parser/test_arf_xml_parser.py | 96472a9d2b08c2afce620c54f229ce95ad019d1f | from pathlib import Path
import pytest
from oval_graph.arf_xml_parser.arf_xml_parser import ARFXMLParser
def get_arf_report_path(src="global_test_data/ssg-fedora-ds-arf.xml"):
return str(Path(__file__).parent.parent / src)
@pytest.mark.parametrize("rule_id, result", [
(
"xccdf_org.ssgproject.conte... | [((234, 897), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""rule_id, result"""', "[('xccdf_org.ssgproject.content_rule_accounts_passwords_pam_faillock_deny',\n 'false'), ('xccdf_org.ssgproject.content_rule_sshd_disable_gssapi_auth',\n 'false'), (\n 'xccdf_org.ssgproject.content_rule_service_debug... |
scottjr632/trump-twitter-bot | main.py | 484b1324d752395338b0a9e5850acf294089b26f | import os
import logging
import argparse
import sys
import signal
import subprocess
from functools import wraps
from dotenv import load_dotenv
load_dotenv(verbose=True)
from app.config import configure_app
from app.bot import TrumpBotScheduler
from app.sentimentbot import SentimentBot
parser = argparse.ArgumentParse... | [((144, 169), 'dotenv.load_dotenv', 'load_dotenv', ([], {'verbose': '(True)'}), '(verbose=True)\n', (155, 169), False, 'from dotenv import load_dotenv\n'), ((298, 339), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""\n"""'}), "(description='\\n')\n", (321, 339), False, 'import argparse\n... |
dendi239/euler | 010-summation-of-primes.py | 71fcdca4a80f9e586aab05eb8acadf1a296dda90 | #! /usr/bin/env python3
import itertools
import typing as tp
def primes() -> tp.Generator[int, None, None]:
primes_ = []
d = 2
while True:
is_prime = True
for p in primes_:
if p * p > d:
break
if d % p == 0:
is_prime = False
... | [] |
letmaik/lensfunpy | setup.py | ddadb6bfd5f3acde5640210aa9f575501e5c0914 | from setuptools import setup, Extension, find_packages
import subprocess
import errno
import re
import os
import shutil
import sys
import zipfile
from urllib.request import urlretrieve
import numpy
from Cython.Build import cythonize
isWindows = os.name == 'nt'
isMac = sys.platform == 'darwin'
is64Bit = sys.maxsize... | [((9442, 9476), 'os.environ.get', 'os.environ.get', (['"""LINETRACE"""', '(False)'], {}), "('LINETRACE', False)\n", (9456, 9476), False, 'import os\n'), ((613, 655), 'os.environ.get', 'os.environ.get', (['"""PKG_CONFIG"""', '"""pkg-config"""'], {}), "('PKG_CONFIG', 'pkg-config')\n", (627, 655), False, 'import os\n'), (... |
bimri/programming_python | chapter_13/mailtools/__init__.py | ba52ccd18b9b4e6c5387bf4032f381ae816b5e77 | "The mailtools Utility Package"
'Initialization File'
"""
##################################################################################
mailtools package: interface to mail server transfers, used by pymail2, PyMailGUI,
and PyMailCGI; does loads, sends, parsing, composing, and deleting, with part
attachments, e... | [] |
jvollhueter/pyMANGA-1 | TreeModelLib/BelowgroundCompetition/__init__.py | 414204a394d44405225b4b8224b19464c1006f1d | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Thu Nov 8 15:25:03 2018
@author: bathmann
"""
from .BelowgroundCompetition import BelowgroundCompetition
from .SimpleTest import SimpleTest
from .FON import FON
from .OGSWithoutFeedback import OGSWithoutFeedback
from .OGSLargeScale3D import OGSLargeScale3... | [] |
SDelhey/websocket-chat | server.py | c7b83583007a723baee25acedbceddd55c12ffec | from flask import Flask, render_template
from flask_socketio import SocketIO, send, emit
app = Flask(__name__)
app.config['SECRET_KEY'] = 'secret!'
socketio = SocketIO(app)
if __name__ == '__main__':
socketio.run(app) | [((96, 111), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (101, 111), False, 'from flask import Flask, render_template\n'), ((160, 173), 'flask_socketio.SocketIO', 'SocketIO', (['app'], {}), '(app)\n', (168, 173), False, 'from flask_socketio import SocketIO, send, emit\n')] |
hadarohana/myCosmos | services/postprocess/src/postprocess.py | 6e4682a2af822eb828180658aaa6d3e304cc85bf | """
Post processing on detected objects
"""
import pymongo
from pymongo import MongoClient
import time
import logging
logging.basicConfig(format='%(levelname)s :: %(asctime)s :: %(message)s', level=logging.DEBUG)
from joblib import Parallel, delayed
import click
from xgboost_model.inference import run_inference, Postpr... | [((118, 216), 'logging.basicConfig', 'logging.basicConfig', ([], {'format': '"""%(levelname)s :: %(asctime)s :: %(message)s"""', 'level': 'logging.DEBUG'}), "(format='%(levelname)s :: %(asctime)s :: %(message)s',\n level=logging.DEBUG)\n", (137, 216), False, 'import logging\n'), ((2490, 2505), 'click.command', 'clic... |
calvinfeng/openvino | model-optimizer/mo/front/common/partial_infer/multi_box_prior_test.py | 11f591c16852637506b1b40d083b450e56d0c8ac | """
Copyright (C) 2018-2021 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.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to i... | [((1975, 2001), 'mo.graph.graph.Node', 'Node', (['graph', '"""prior_box_1"""'], {}), "(graph, 'prior_box_1')\n", (1979, 2001), False, 'from mo.graph.graph import Node\n'), ((2011, 2060), 'mo.front.common.partial_infer.multi_box_prior.multi_box_prior_infer_mxnet', 'multi_box_prior_infer_mxnet', (['multi_box_prior_node']... |
Samahu/ros-system-monitor | bin/mem_monitor.py | 5376eba046ac38cfe8fe9ff8b385fa2637015eda | #!/usr/bin/env python
############################################################################
# Copyright (C) 2009, Willow Garage, Inc. #
# Copyright (C) 2013 by Ralf Kaestner #
# ralf.kaestner@gmail.com ... | [] |
stamhe/bitcoin-abc | cmake/utils/gen-ninja-deps.py | a1ba303c6b4f164ae94612e83b824e564405a96e | #!/usr/bin/env python3
import argparse
import os
import subprocess
parser = argparse.ArgumentParser(description='Produce a dep file from ninja.')
parser.add_argument(
'--build-dir',
help='The build directory.',
required=True)
parser.add_argument(
'--base-dir',
help='The directory for which depende... | [((78, 147), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Produce a dep file from ninja."""'}), "(description='Produce a dep file from ninja.')\n", (101, 147), False, 'import argparse\n'), ((753, 784), 'os.path.abspath', 'os.path.abspath', (['args.build_dir'], {}), '(args.build_dir)\n'... |
ptphp/PyLib | src/webpy1/src/manage/checkPic.py | 07ac99cf2deb725475f5771b123b9ea1375f5e65 | '''
Created on 2011-6-22
@author: dholer
'''
| [] |
coleb/sendoff | tests/__init__.py | fc1b38ba7571254a88ca457f6f618ae4572f30b6 | """Tests for the `sendoff` library."""
"""
The `sendoff` library tests validate the expected function of the library.
"""
| [] |
Wind-River/starlingx-config | sysinv/sysinv/sysinv/sysinv/helm/garbd.py | 96b92e5179d54dde10cb84c943eb239adf26b958 | #
# Copyright (c) 2018-2019 Wind River Systems, Inc.
#
# SPDX-License-Identifier: Apache-2.0
#
from sysinv.common import constants
from sysinv.common import exception
from sysinv.common import utils
from sysinv.helm import common
from sysinv.helm import base
class GarbdHelm(base.BaseHelm):
"""Class to encapsulat... | [((1437, 1475), 'sysinv.common.utils.is_aio_duplex_system', 'utils.is_aio_duplex_system', (['self.dbapi'], {}), '(self.dbapi)\n', (1463, 1475), False, 'from sysinv.common import utils\n'), ((2331, 2400), 'sysinv.common.exception.InvalidHelmNamespace', 'exception.InvalidHelmNamespace', ([], {'chart': 'self.CHART', 'name... |
aaron-zou/pretraining-twostream | dataloader/frame_counter/frame_counter.py | 5aa2f4bafb731e61f8f671e2500a6dfa8436be57 | #!/usr/bin/env python
"""Generate frame counts dict for a dataset.
Usage:
frame_counter.py [options]
Options:
-h, --help Print help message
--root=<str> Path to root of dataset (should contain video folders that contain images)
[default: /vision/vision_users/azou/data/hmdb5... | [((552, 567), 'docopt.docopt', 'docopt', (['__doc__'], {}), '(__doc__)\n', (558, 567), False, 'from docopt import docopt\n'), ((714, 737), 'os.walk', 'os.walk', (["args['--root']"], {}), "(args['--root'])\n", (721, 737), False, 'import os\n'), ((1196, 1222), 'pickle.dump', 'pickle.dump', (['counts', 'ofile'], {}), '(co... |
jdalzatec/EulerProject | Problem_30/main.py | 2f2f4d9c009be7fd63bb229bb437ea75db77d891 | total = 0
for n in range(1000, 1000000):
suma = 0
for i in str(n):
suma += int(i)**5
if (n == suma):
total += n
print(total) | [] |
celikten/armi | armi/physics/fuelCycle/settings.py | 4e100dd514a59caa9c502bd5a0967fd77fdaf00e | """Settings for generic fuel cycle code."""
import re
import os
from armi.settings import setting
from armi.operators import settingsValidation
CONF_ASSEMBLY_ROTATION_ALG = "assemblyRotationAlgorithm"
CONF_ASSEM_ROTATION_STATIONARY = "assemblyRotationStationary"
CONF_CIRCULAR_RING_MODE = "circularRingMode"
CONF_CIRCU... | [((795, 1081), 'armi.settings.setting.Setting', 'setting.Setting', (['CONF_ASSEMBLY_ROTATION_ALG'], {'default': '""""""', 'label': '"""Assembly Rotation Algorithm"""', 'description': '"""The algorithm to use to rotate the detail assemblies while shuffling"""', 'options': "['', 'buReducingAssemblyRotation', 'simpleAssem... |
jclosure/donkus | nl/predictor.py | b3384447094b2ecbaff5ee9d970818313b6ee8b0 |
from nltk.corpus import gutenberg
from nltk import ConditionalFreqDist
from random import choice
#create the distribution object
cfd = ConditionalFreqDist()
## for each token count the current word given the previous word
prev_word = None
for word in gutenberg.words('austen-persuasion.txt'):
cfd[prev_word][word]... | [] |
mmg-3/cloudserver | eve/workers/pykmip/bin/run_server.py | 9ff6364b2ed4f33a5135d86311a72de4caff51c1 | #!/usr/bin/env python
# Copyright (c) 2016 The Johns Hopkins University/Applied Physics Laboratory
# 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.ap... | [((699, 739), 'logging.basicConfig', 'logging.basicConfig', ([], {'level': 'logging.DEBUG'}), '(level=logging.DEBUG)\n', (718, 739), False, 'import logging\n'), ((879, 892), 'kmip.services.server.server.main', 'server.main', ([], {}), '()\n', (890, 892), False, 'from kmip.services.server import server\n')] |
yokaze/crest-python | tests/test_tempo_event.py | c246b16ade6fd706f0e18aae797660064bddd555 | #
# test_tempo_event.py
# crest-python
#
# Copyright (C) 2017 Rue Yokaze
# Distributed under the MIT License.
#
import crest_loader
import unittest
from crest.events.meta import TempoEvent
class TestTempoEvent(unittest.TestCase):
def test_ctor(self):
TempoEvent()
TempoEvent(120)
def t... | [((873, 888), 'unittest.main', 'unittest.main', ([], {}), '()\n', (886, 888), False, 'import unittest\n'), ((273, 285), 'crest.events.meta.TempoEvent', 'TempoEvent', ([], {}), '()\n', (283, 285), False, 'from crest.events.meta import TempoEvent\n'), ((294, 309), 'crest.events.meta.TempoEvent', 'TempoEvent', (['(120)'],... |
PyJedi/quantum | tensorflow_quantum/python/differentiators/__init__.py | 3f4a3c320e048b8a8faf3a10339975d2d5366fb6 | # Copyright 2020 The TensorFlow Quantum 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... | [] |
erykoff/redmapper | tests/test_color_background.py | 23fb66c7369de784c67ce6c41ada2f1f51a84acb | import unittest
import numpy.testing as testing
import numpy as np
import fitsio
import tempfile
import os
from redmapper import ColorBackground
from redmapper import ColorBackgroundGenerator
from redmapper import Configuration
class ColorBackgroundTestCase(unittest.TestCase):
"""
Tests for the redmapper.Colo... | [((3829, 3844), 'unittest.main', 'unittest.main', ([], {}), '()\n', (3842, 3844), False, 'import unittest\n'), ((604, 653), 'redmapper.ColorBackground', 'ColorBackground', (["('%s/%s' % (file_path, file_name))"], {}), "('%s/%s' % (file_path, file_name))\n", (619, 653), False, 'from redmapper import ColorBackground\n'),... |
Exi666/MetPy | src/metpy/calc/basic.py | c3cf8b9855e0ce7c14347e9d000fc3d531a18e1c | # Copyright (c) 2008,2015,2016,2017,2018,2019 MetPy Developers.
# Distributed under the terms of the BSD 3-Clause License.
# SPDX-License-Identifier: BSD-3-Clause
"""Contains a collection of basic calculations.
These include:
* wind components
* heat index
* windchill
"""
import warnings
import numpy as np
from scip... | [((1176, 1198), 'numpy.sqrt', 'np.sqrt', (['(u * u + v * v)'], {}), '(u * u + v * v)\n', (1183, 1198), True, 'import numpy as np\n'), ((2865, 2882), 'numpy.any', 'np.any', (['calm_mask'], {}), '(calm_mask)\n', (2871, 2882), True, 'import numpy as np\n'), ((8772, 8783), 'numpy.any', 'np.any', (['sel'], {}), '(sel)\n', (... |
wryfi/burl | burl/core/api/views.py | 664878ce9a31695456be89c8e10e8bb612074ef6 | from rest_framework.response import Response
from rest_framework.decorators import api_view
from rest_framework.reverse import reverse
from rest_framework_simplejwt.tokens import RefreshToken
@api_view(['GET'])
def root(request, fmt=None):
return Response({
'v1': reverse('api_v1:root', request=request, fo... | [((195, 212), 'rest_framework.decorators.api_view', 'api_view', (["['GET']"], {}), "(['GET'])\n", (203, 212), False, 'from rest_framework.decorators import api_view\n'), ((341, 358), 'rest_framework.decorators.api_view', 'api_view', (["['GET']"], {}), "(['GET'])\n", (349, 358), False, 'from rest_framework.decorators im... |
RomulusGwelt/AngularProject | ITmeetups_back/api/serializers.py | acc7083f30b1edf002da8d156be023d2432a05e4 | from rest_framework import serializers
from .models import Post, Comment, Like
from django.contrib.auth.models import User
class CurrentUserSerializer(serializers.ModelSerializer):
class Meta:
model = User
fields = ('id', 'username', 'email')
class PostSerializer(serializers.ModelSerializer):
... | [] |
qurator-spk/sbb_ned | qurator/sbb_ned/embeddings/bert.py | d4cfe249f72e48913f254a58fbe0dbe6e47bd168 | from ..embeddings.base import Embeddings
from flair.data import Sentence
class BertEmbeddings(Embeddings):
def __init__(self, model_path,
layers="-1, -2, -3, -4", pooling_operation='first', use_scalar_mix=True, no_cuda=False, *args, **kwargs):
super(BertEmbeddings, self).__init__(*args... | [((1152, 1165), 'flair.data.Sentence', 'Sentence', (['key'], {}), '(key)\n', (1160, 1165), False, 'from flair.data import Sentence\n'), ((741, 760), 'torch.device', 'torch.device', (['"""cpu"""'], {}), "('cpu')\n", (753, 760), False, 'import torch\n')] |
ronaldzgithub/CryptoArbitrage | Arbitrage_Future/Arbitrage_Future/test.py | b4b7a12b7b11f3dcf950f9d2039dad4f1388530b | # !/usr/local/bin/python
# -*- coding:utf-8 -*-
import YunBi
import CNBTC
import json
import threading
import Queue
import time
import logging
import numpy
import message
import random
open_platform = [True,True,True,True]
numpy.set_printoptions(suppress=True)
# logging.basicConfig(level=logging.DEBUG,
# ... | [] |
cudmore/startupnotify | startuptweet.py | 76b61b295ae7049e597fa05457a6696e624c4955 | #!/usr/bin/python3
"""
Author: Robert Cudmore
Date: 20181013
Purpose: Send a Tweet with IP and MAC address of a Raspberry Pi
Install:
pip3 install tweepy
Usage:
python3 startuptweet.py 'this is my tweet'
"""
import tweepy
import sys
import socket
import subprocess
from uuid import getnode as get_mac
from datetime i... | [((675, 725), 'tweepy.OAuthHandler', 'tweepy.OAuthHandler', (['consumer_key', 'consumer_secret'], {}), '(consumer_key, consumer_secret)\n', (694, 725), False, 'import tweepy\n'), ((789, 805), 'tweepy.API', 'tweepy.API', (['auth'], {}), '(auth)\n', (799, 805), False, 'import tweepy\n'), ((869, 928), 'subprocess.check_ou... |
VW-Stephen/pySpiderScrape | distributed/db.py | 861d7289743d5b65916310448526a58b381fde8d | #!/usr/bin/python
from bs4 import BeautifulSoup
import sqlite3
class DB:
"""
Abstraction for the profile database
"""
def __init__(self, filename):
"""
Creates a new connection to the database
filename - The name of the database file to use
"""
self.Filename = ... | [((355, 380), 'sqlite3.connect', 'sqlite3.connect', (['filename'], {}), '(filename)\n', (370, 380), False, 'import sqlite3\n')] |
bansal-shubham/stopstalk-deployment | private/scripts/recheck-invalid-handles.py | 6392eace490311be103292fdaff9ae215e4db7e6 | """
Copyright (c) 2015-2019 Raj Patel(raj454raj@gmail.com), StopStalk
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
... | [] |
gpminsuk/onnxmltools | onnxmltools/convert/keras/_parse.py | 4e88929a79a1018183f58e2d5e032dd639839dd2 | # -------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
# --------------------------------------------------------------------------
import te... | [] |
cahartsell/Scenic | src/scenic/core/regions.py | 2e7979011aef426108687947668d9ba6f5439136 | """Objects representing regions in space."""
import math
import random
import itertools
import numpy
import scipy.spatial
import shapely.geometry
import shapely.ops
from scenic.core.distributions import Samplable, RejectionException, needsSampling
from scenic.core.lazy_eval import valueInContext
from scenic.core.vec... | [((739, 759), 'scenic.core.distributions.needsSampling', 'needsSampling', (['thing'], {}), '(thing)\n', (752, 759), False, 'from scenic.core.distributions import Samplable, RejectionException, needsSampling\n'), ((3511, 3571), 'scenic.core.type_support.toVector', 'toVector', (['thing', '""""X in Y" with X not an Object... |
mrahnis/orangery | orangery/cli/cutfill.py | 69afe0057bd61163eb8e026e58d648dfa1e73b94 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys
import logging
import time
import json
import click
import matplotlib.pyplot as plt
import orangery as o
from orangery.cli import defaults, util
from orangery.tools.plotting import get_scale_factor
@click.command(options_metavar='<options>')
@click.argument(... | [((261, 303), 'click.command', 'click.command', ([], {'options_metavar': '"""<options>"""'}), "(options_metavar='<options>')\n", (274, 303), False, 'import click\n'), ((575, 628), 'click.argument', 'click.argument', (['"""fields"""'], {'nargs': '(1)', 'metavar': '"""<fields>"""'}), "('fields', nargs=1, metavar='<fields... |
cadia-lvl/ice-g2p | src/ice_g2p/dictionaries.py | 5a6cc55f45282e8a656ea0742e2f373189c9a912 | import os, sys
DICTIONARY_FILE = os.path.join(sys.prefix, 'dictionaries/ice_pron_dict_standard_clear.csv')
HEAD_FILE = os.path.join(sys.prefix, 'data/head_map.csv')
MODIFIER_FILE = os.path.join(sys.prefix, 'data/modifier_map.csv')
VOWELS_FILE = os.path.join(sys.prefix, 'data/vowels_sampa.txt')
CONS_CLUSTERS_FILE = os.p... | [((33, 106), 'os.path.join', 'os.path.join', (['sys.prefix', '"""dictionaries/ice_pron_dict_standard_clear.csv"""'], {}), "(sys.prefix, 'dictionaries/ice_pron_dict_standard_clear.csv')\n", (45, 106), False, 'import os, sys\n'), ((119, 164), 'os.path.join', 'os.path.join', (['sys.prefix', '"""data/head_map.csv"""'], {})... |
jeromedockes/pylabelbuddy | tests/test_annotations_notebook.py | 26be00db679e94117968387aa7010dab2739b517 | from pylabelbuddy import _annotations_notebook
def test_annotations_notebook(root, annotations_mock, dataset_mock):
nb = _annotations_notebook.AnnotationsNotebook(
root, annotations_mock, dataset_mock
)
nb.change_database()
assert nb.notebook.index(nb.notebook.select()) == 2
nb.go_to_annot... | [((127, 206), 'pylabelbuddy._annotations_notebook.AnnotationsNotebook', '_annotations_notebook.AnnotationsNotebook', (['root', 'annotations_mock', 'dataset_mock'], {}), '(root, annotations_mock, dataset_mock)\n', (168, 206), False, 'from pylabelbuddy import _annotations_notebook\n')] |
zcemycl/algoTest | py/solns/wordSearch/wordSearch.py | 9518fb2b60fd83c85aeb2ab809ff647aaf643f0a | class Solution:
@staticmethod
def naive(board,word):
rows,cols,n = len(board),len(board[0]),len(word)
visited = set()
def dfs(i,j,k):
idf = str(i)+','+str(j)
if i<0 or j<0 or i>cols-1 or j>rows-1 or \
board[j][i]!=word[k] or idf in visited:
... | [] |
natedogg484/react-flask-authentication | middleware/run.py | 5000685d35471b03f72e0b07dfbdbf6d5fc296d2 | from flask import Flask
from flask_cors import CORS
from flask_restful import Api
from flask_sqlalchemy import SQLAlchemy
from flask_jwt_extended import JWTManager
app = Flask(__name__)
CORS(app)
api = Api(app)
app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///app.db'
app.config['SQLALCHEMY_TRACK_MODIFICATIONS'] =... | [((172, 187), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (177, 187), False, 'from flask import Flask\n'), ((188, 197), 'flask_cors.CORS', 'CORS', (['app'], {}), '(app)\n', (192, 197), False, 'from flask_cors import CORS\n'), ((204, 212), 'flask_restful.Api', 'Api', (['app'], {}), '(app)\n', (207, 212),... |
carvalhopedro22/Programas-em-python-cursos-e-geral- | Programas do Curso/Desafio 2.py | 970e1ebe6cdd1e31f52dfd60328c2203d4de3ef1 | nome = input('Qual o seu nome? ')
dia = input('Que dia do mês você nasceu? ')
mes = input('Qual o mês em que você nasceu? ')
ano = input('Qual o ano em que você nasceu? ')
print(nome, 'nasceu em', dia,'de',mes,'do ano',ano) | [] |
prorevizor/noc | cmibs/cisco_vlan_membership_mib.py | 37e44b8afc64318b10699c06a1138eee9e7d6a4e | # ----------------------------------------------------------------------
# CISCO-VLAN-MEMBERSHIP-MIB
# Compiled MIB
# Do not modify this file directly
# Run ./noc mib make-cmib instead
# ----------------------------------------------------------------------
# Copyright (C) 2007-2020 The NOC Project
# See LICENSE for de... | [] |
tdimnet/integrations-core | harbor/tests/test_unit.py | a78133a3b71a1b8377fa214d121a98647031ab06 | # (C) Datadog, Inc. 2019-present
# All rights reserved
# Licensed under a 3-clause BSD style license (see LICENSE)
import pytest
from mock import MagicMock
from requests import HTTPError
from datadog_checks.base import AgentCheck
from datadog_checks.dev.http import MockResponse
from .common import HARBOR_COMPONENTS, ... | [((377, 418), 'pytest.mark.usefixtures', 'pytest.mark.usefixtures', (['"""patch_requests"""'], {}), "('patch_requests')\n", (400, 418), False, 'import pytest\n'), ((1311, 1352), 'pytest.mark.usefixtures', 'pytest.mark.usefixtures', (['"""patch_requests"""'], {}), "('patch_requests')\n", (1334, 1352), False, 'import pyt... |
CN-UPB/SPRING | M-SPRING/template/adapter.py | 1cb74919689e832987cb2c9b490eec7f09a64f52 | # module for adapting templates on the fly if components are reused
# check that all reused components are defined consistently -> else: exception
def check_consistency(components):
for j1 in components:
for j2 in components: # compare all components
if j1 == j2 and j1.__dict__ != j2.__dict__: # same n... | [] |
AllanLRH/column_completer | column_completer.py | c1a0e1915256a4e3825c5c3b9863d78fdaf50be1 | class ColumnCompleter(object):
"""Complete Pandas DataFrame column names"""
def __init__(self, df, space_filler='_', silence_warnings=False):
"""
Once instantiated with a Pandas DataFrame, it will expose the column
names as attributes which maps to their string counterparts.
Au... | [] |
ramkrsna/virtual-storage-manager | source/vsm-dashboard/vsm_dashboard/test/test_data/swift_data.py | 78125bfb4dd4d78ff96bc3274c8919003769c545 | # Copyright 2012 Nebula, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agree... | [((1295, 1357), 'vsm_dashboard.api.swift.StorageObject', 'swift.StorageObject', (['obj_dict', 'container_1.name'], {'data': 'obj_data'}), '(obj_dict, container_1.name, data=obj_data)\n', (1314, 1357), False, 'from vsm_dashboard.api import swift\n')] |
liangintel/stx-cinder | cinder/backup/driver.py | f4c43797a3f8c0caebfd8fb67244c084d26d9741 | # Copyright (C) 2013 Deutsche Telekom AG
# 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 r... | [((1707, 1734), 'oslo_log.log.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (1724, 1734), True, 'from oslo_log import log as logging\n'), ((14479, 14509), 'six.add_metaclass', 'six.add_metaclass', (['abc.ABCMeta'], {}), '(abc.ABCMeta)\n', (14496, 14509), False, 'import six\n'), ((17554, 17584), '... |
ENDERZOMBI102/chained | __init__.py | d01f04d1eb9a913f64cea9da52e61d91300315ff | from .chainOpen import chainOpen
__all__ = [
'chainOpen'
] | [] |
andrewsu/RTX | code/reasoningtool/tests/QuerySciGraphTests.py | dd1de262d0817f7e6d2f64e5bec7d5009a3a2740 | import unittest
from QuerySciGraph import QuerySciGraph
class QuerySciGraphTestCase(unittest.TestCase):
def test_get_disont_ids_for_mesh_id(self):
disont_ids = QuerySciGraph.get_disont_ids_for_mesh_id('MESH:D005199')
known_ids = {'DOID:13636'}
self.assertSetEqual(disont_ids, known_ids)
... | [((1130, 1145), 'unittest.main', 'unittest.main', ([], {}), '()\n', (1143, 1145), False, 'import unittest\n'), ((174, 230), 'QuerySciGraph.QuerySciGraph.get_disont_ids_for_mesh_id', 'QuerySciGraph.get_disont_ids_for_mesh_id', (['"""MESH:D005199"""'], {}), "('MESH:D005199')\n", (214, 230), False, 'from QuerySciGraph imp... |
gianghta/Ledis | ledis/cli.py | a6b31617621746344408ee411cf510ef3cfb2e7b | from typing import Any
from ledis import Ledis
from ledis.exceptions import InvalidUsage
class CLI:
__slots__ = {"ledis", "commands"}
def __init__(self):
self.ledis = Ledis()
self.commands = {
"set": self.ledis.set,
"get": self.ledis.get,
"sadd": self.ledi... | [((187, 194), 'ledis.Ledis', 'Ledis', ([], {}), '()\n', (192, 194), False, 'from ledis import Ledis\n'), ((1048, 1147), 'ledis.exceptions.InvalidUsage', 'InvalidUsage', (['f"""Command \'{command}\' is invalid. Allowed commands are {allowed_commands}."""'], {}), '(\n f"Command \'{command}\' is invalid. Allowed comman... |
nazhanshaberi/miniature-octo-barnacle | ClosedLoopTF.py | eb1a8b5366003bf2d0f7e89af9d9dea120965f4f | #group 1: Question 1(b)
# A control system for positioning the head of a laser printer has the closed loop transfer function:
# !pip install control
import matplotlib.pyplot as plt
import control
a=10 #Value for a
b=50 #value for b
sys1 = control.tf(20*b,[1,20+a,b+20*a,20*b])
print('3rd order system transfer funct... | [((244, 295), 'control.tf', 'control.tf', (['(20 * b)', '[1, 20 + a, b + 20 * a, 20 * b]'], {}), '(20 * b, [1, 20 + a, b + 20 * a, 20 * b])\n', (254, 295), False, 'import control\n'), ((343, 367), 'control.tf', 'control.tf', (['b', '[1, a, b]'], {}), '(b, [1, a, b])\n', (353, 367), False, 'import control\n'), ((523, 55... |
bastiedotorg/django-precise-bbcode | example_project/test_messages/bbcode_tags.py | 567a8a7f104fb7f2c9d59f304791e53d2d8f4dea | import re
from precise_bbcode.bbcode.tag import BBCodeTag
from precise_bbcode.tag_pool import tag_pool
color_re = re.compile(r'^([a-z]+|#[0-9abcdefABCDEF]{3,6})$')
class SubTag(BBCodeTag):
name = 'sub'
def render(self, value, option=None, parent=None):
return '<sub>%s</sub>' % value
class PreTag... | [((117, 165), 're.compile', 're.compile', (['"""^([a-z]+|#[0-9abcdefABCDEF]{3,6})$"""'], {}), "('^([a-z]+|#[0-9abcdefABCDEF]{3,6})$')\n", (127, 165), False, 'import re\n'), ((1716, 1745), 'precise_bbcode.tag_pool.tag_pool.register_tag', 'tag_pool.register_tag', (['SubTag'], {}), '(SubTag)\n', (1737, 1745), False, 'from... |
ramtingh/vmtk | tests/test_vmtkScripts/test_vmtksurfacescaling.py | 4d6f58ce65d73628353ba2b110cbc29a2e7aa7b3 | ## Program: VMTK
## Language: Python
## Date: January 10, 2018
## Version: 1.4
## Copyright (c) Richard Izzo, Luca Antiga, All rights reserved.
## See LICENSE file for details.
## This software is distributed WITHOUT ANY WARRANTY; without even
## the implied warranty of MERCHANTABILITY or FITNES... | [((890, 1081), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""xfactor,yfactor,zfactor,paramid"""', "[(2, None, None, '0'), (None, 2, None, '1'), (None, None, 2, '2'), (2, 2,\n None, '3'), (2, None, 2, '4'), (None, 2, 2, '5')]"], {}), "('xfactor,yfactor,zfactor,paramid', [(2, None, None,\n '0'), (None... |
yangyimincn/tencentcloud-sdk-python | tencentcloud/vpc/v20170312/models.py | 1d4f1bd83bb57a91bb6d2631131a339bc1f9b91d | # -*- coding: utf8 -*-
# Copyright 1999-2017 Tencent 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 applicable l... | [] |
nobodywasishere/MLCSim | mlcsim/dist.py | a3eb3d39b6970a4e706e292c6a283531fb44350c | #!/usr/bin/env python
"""Distribution functions
This module provides functions for dealing with normal distributions
and generating error maps.
When called directly as main, it allows for converting a threshold map
into an error map.
```
$ python -m mlcsim.dist --help
usage: dist.py [-h] [-b {1,2,3,4}] -f F [-o O]... | [((1404, 1423), 'numpy.roots', 'np.roots', (['[a, b, c]'], {}), '([a, b, c])\n', (1412, 1423), True, 'import numpy as np\n'), ((1437, 1480), 'numpy.ma.masked_outside', 'np.ma.masked_outside', (['roots', 'mean_a', 'mean_b'], {}), '(roots, mean_a, mean_b)\n', (1457, 1480), True, 'import numpy as np\n'), ((3098, 3123), 'a... |
JackShen1/pr-labs | Pr-Lab5/lab5.py | c84df379d8f7b26ccff30248dfb23ae38e0ce7c2 | earth = {
"Asia":
{'Japan': ("Tokyo", 377975, 125620000)},
"Europe":
{'Austria': ("Vienna", 83800, 8404000),
'Germany': ("Berlin", 357000, 81751000),
'Great Britain': ("London", 244800, 62700000),
'Iceland': ("Reykjavík", 103000, 317630),
'Italy': ("Rome", 301... | [] |
ubiquitoustech/rules_vue | vue/repositories.bzl | 759786eae1b6caf647b1c6018e16030a66e486e2 | """Declare runtime dependencies
These are needed for local dev, and users must install them as well.
See https://docs.bazel.build/versions/main/skylark/deploying.html#dependencies
"""
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
load("@bazel_tools//tools/build_defs/repo:utils.bzl", "maybe")
#... | [] |
kwestpharedhat/quay | endpoints/api/test/test_tag.py | a0df895005bcd3e53847046f69f6a7add87c88fd | import pytest
from playhouse.test_utils import assert_query_count
from data.registry_model import registry_model
from data.database import Manifest
from endpoints.api.test.shared import conduct_api_call
from endpoints.test.shared import client_with_identity
from endpoints.api.tag import RepositoryTag, RestoreTag, Li... | [((369, 468), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""expiration_time, expected_status"""', "[(None, 201), ('aksdjhasd', 400)]"], {}), "('expiration_time, expected_status', [(None, 201), (\n 'aksdjhasd', 400)])\n", (392, 468), False, 'import pytest\n'), ((1609, 2020), 'pytest.mark.parametrize', '... |
Jongerr/vendor_receiving | inventory.py | f69f09a5b41d38b45e9ea0bf82590bb27ce913f6 | import json
import os
import random
import requests
from passlib.hash import pbkdf2_sha256 as pbk
from PyQt5.QtSql import QSqlDatabase, QSqlQuery
from pprint import pprint
ENCODING = 'utf-8'
DB_PATH = os.path.join(os.path.curdir, 'inventory.db')
def scrambleWord(word):
"""Randomize the letters in word and retur... | [((203, 247), 'os.path.join', 'os.path.join', (['os.path.curdir', '"""inventory.db"""'], {}), "(os.path.curdir, 'inventory.db')\n", (215, 247), False, 'import os\n'), ((378, 403), 'random.shuffle', 'random.shuffle', (['word_list'], {}), '(word_list)\n', (392, 403), False, 'import random\n'), ((768, 828), 'requests.get'... |
frennkie/lnbits | lnbits/core/views/lnurl.py | 5fe64d324dc7ac05d1d0fc25eb5ad6a5a414ea8a | import requests
from flask import abort, redirect, request, url_for
from lnurl import LnurlWithdrawResponse, handle as handle_lnurl
from lnurl.exceptions import LnurlException
from time import sleep
from lnbits.core import core_app
from lnbits.helpers import Status
from lnbits.settings import WALLET
from ..crud impo... | [((382, 412), 'lnbits.core.core_app.route', 'core_app.route', (['"""/lnurlwallet"""'], {}), "('/lnurlwallet')\n", (396, 412), False, 'from lnbits.core import core_app\n'), ((961, 1103), 'requests.get', 'requests.get', (['withdraw_res.callback.base'], {'params': "{**withdraw_res.callback.query_params, **{'k1': withdraw_... |
munishm/MLOpsPython | driver_training/driver_training.py | e3ee31f6a0cac645a2b3ad945b8263e07d3085e4 | # Import libraries
import argparse
from azureml.core import Run
import joblib
import json
import os
import pandas as pd
import shutil
# Import functions from train.py
from train import split_data, train_model, get_model_metrics
# Get the output folder for the model from the '--output_folder' parameter
parser = argpar... | [((314, 339), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (337, 339), False, 'import argparse\n'), ((546, 563), 'azureml.core.Run.get_context', 'Run.get_context', ([], {}), '()\n', (561, 563), False, 'from azureml.core import Run\n'), ((618, 678), 'pandas.read_csv', 'pd.read_csv', (['"""port... |
madman-bob/python-lua-imports | tests/__init__.py | 76d3765b03a0478544214022118e5a4a13f6e36a | from lua_imports import lua_importer
lua_importer.register()
| [((38, 61), 'lua_imports.lua_importer.register', 'lua_importer.register', ([], {}), '()\n', (59, 61), False, 'from lua_imports import lua_importer\n')] |
VyachAp/SalesFABackend | app/models/product.py | dcbe1b5106c030ee07535795dfd7b97613a1203d | from sqlalchemy import Column, Integer, String, Float
from app.database.base_class import Base
class Product(Base):
id = Column(Integer, primary_key=True, index=True)
name = Column(String, nullable=False)
price = Column(Float, nullable=False)
| [((128, 173), 'sqlalchemy.Column', 'Column', (['Integer'], {'primary_key': '(True)', 'index': '(True)'}), '(Integer, primary_key=True, index=True)\n', (134, 173), False, 'from sqlalchemy import Column, Integer, String, Float\n'), ((185, 215), 'sqlalchemy.Column', 'Column', (['String'], {'nullable': '(False)'}), '(Strin... |
warriorframework/Katanaframework | katana/utils/directory_traversal_utils.py | 9dc78df9d0c8f19ef5eaaa8690fbfa1ad885b323 | import glob
import os
import re
import errno
import shutil
def get_sub_dirs_and_files(path, abs_path=False):
"""
Gets the direct child sub-files and sub-folders of the given directory
Args:
path: Absolute path to the directory
abs_path: If set to True, it returns a list of absolute paths ... | [((1160, 1190), 'glob.glob', 'glob.glob', (["(path + os.sep + '*')"], {}), "(path + os.sep + '*')\n", (1169, 1190), False, 'import glob\n'), ((1867, 1899), 'glob.glob', 'glob.glob', (["(path + os.sep + '*.*')"], {}), "(path + os.sep + '*.*')\n", (1876, 1899), False, 'import glob\n'), ((3573, 3592), 're.compile', 're.co... |
LucaOnline/theanine-synthetase | alignment.py | 75a9d1f6d853409e12bf9f3b6e5948b594a03217 | """The `alignment` module provides an implementation of the Needleman-Wunsch alignment algorithm."""
from typing import Tuple, Literal, List
from math import floor
import numpy as np
from stats import variance
MOVE_DIAGONAL = 0
MOVE_RIGHT = 1
MOVE_DOWN = 2
EditMove = Literal[MOVE_DIAGONAL, MOVE_RIGHT, MOVE_DOWN]
... | [((7128, 7166), 'numpy.zeros', 'np.zeros', (['(size2, size1)'], {'dtype': 'np.int'}), '((size2, size1), dtype=np.int)\n', (7136, 7166), True, 'import numpy as np\n')] |
yujialuo/erdos | examples/the-feeling-of-success/mock_grasp_object_op.py | 7a631b55895f1a473b0f4d38a0d6053851e65b5d | from mock_gripper_op import MockGripType
from std_msgs.msg import Bool
from erdos.op import Op
from erdos.data_stream import DataStream
from erdos.message import Message
class MockGraspObjectOperator(Op):
"""
Sends a "close" action to the gripper.
"""
gripper_stream = "gripper-output-stream"
acti... | [((1648, 1669), 'mock_gripper_op.MockGripType', 'MockGripType', (['"""close"""'], {}), "('close')\n", (1660, 1669), False, 'from mock_gripper_op import MockGripType\n'), ((1695, 1736), 'erdos.message.Message', 'Message', (['mock_grasp_object', 'msg.timestamp'], {}), '(mock_grasp_object, msg.timestamp)\n', (1702, 1736),... |
taliamax/pyfsa | src/pyfsa/lib/fsa.py | d92faa96c1e17e4016df7b367c7d405a07f1253b | # -*- coding: utf-8 -*-
import pygraphviz as gv # type: ignore
import itertools as it
from typing import (
List,
Optional,
)
from pyfsa.lib.types import TransitionsTable
def get_state_graph(
transitions: TransitionsTable,
start: Optional[str] = None,
end: Optional[str] = None,
nodes: Option... | [((626, 677), 'pygraphviz.AGraph', 'gv.AGraph', ([], {'directed': '(True)', 'strict': '(False)', 'ranksep': '"""1"""'}), "(directed=True, strict=False, ranksep='1')\n", (635, 677), True, 'import pygraphviz as gv\n'), ((692, 702), 'itertools.count', 'it.count', ([], {}), '()\n', (700, 702), True, 'import itertools as it... |
kapikantzari/MultiBench | examples/multimedia/mmimdb_MFM.py | 44ab6ea028682040a0c04de68239ce5cdf15123f | import torch
import sys
import os
sys.path.append(os.getcwd())
from utils.helper_modules import Sequential2
from unimodals.common_models import Linear, MLP, MaxOut_MLP
from datasets.imdb.get_data import get_dataloader
from fusions.common_fusions import Concat
from objective_functions.objectives_for_supervised_learnin... | [((515, 611), 'datasets.imdb.get_data.get_dataloader', 'get_dataloader', (['"""../video/multimodal_imdb.hdf5"""', '"""../video/mmimdb"""'], {'vgg': '(True)', 'batch_size': '(128)'}), "('../video/multimodal_imdb.hdf5', '../video/mmimdb', vgg=True,\n batch_size=128)\n", (529, 611), False, 'from datasets.imdb.get_data ... |
izumin2000/izuminapp | subeana/migrations/0001_initial.py | 3464cebe1d98c85c2cd95c6fac779ec1f42ef930 | # Generated by Django 4.0.2 on 2022-06-01 04:43
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='Channel',
fields=[
... | [((336, 432), 'django.db.models.BigAutoField', 'models.BigAutoField', ([], {'auto_created': '(True)', 'primary_key': '(True)', 'serialize': '(False)', 'verbose_name': '"""ID"""'}), "(auto_created=True, primary_key=True, serialize=False,\n verbose_name='ID')\n", (355, 432), False, 'from django.db import migrations, m... |
shirubana/bifacialvf | bifacialvf/vf.py | 7cd1c4c658bb7a68f0815b2bd1a6d5c492ca7300 | # -*- coding: utf-8 -*-
"""
ViewFactor module - VF calculation helper files for bifacial-viewfactor
@author Bill Marion
@translated to python by sayala 06/09/17
"""
# ensure python3 compatible division and printing
from __future__ import division, print_function, absolute_import
import math
import numpy as np
fr... | [((477, 504), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (494, 504), False, 'import logging\n'), ((8037, 8079), 'sun.perezComp', 'perezComp', (['dni', 'dhi', 'albedo', 'zen', '(0.0)', 'zen'], {}), '(dni, dhi, albedo, zen, 0.0, zen)\n', (8046, 8079), False, 'from sun import solarPos, s... |
Habidatum/slisonner | tests/test_slison.py | 488be30a199a5d29271e24377c37a7ad83d52e3e | from slisonner import decoder, encoder
from tests import mocker
from tempfile import mkdtemp
from shutil import rmtree
def test_full_encode_decode_cycle():
temp_out_dir = mkdtemp()
slice_id = '2015-01-02 00:00:00'
x_size, y_size = 10, 16
temp_slice_path = mocker.generate_slice(x_size, y_size, 'float3... | [((177, 186), 'tempfile.mkdtemp', 'mkdtemp', ([], {}), '()\n', (184, 186), False, 'from tempfile import mkdtemp\n'), ((275, 323), 'tests.mocker.generate_slice', 'mocker.generate_slice', (['x_size', 'y_size', '"""float32"""'], {}), "(x_size, y_size, 'float32')\n", (296, 323), False, 'from tests import mocker\n'), ((367,... |
vignesharumainayagam/cartrade | cartrade/cartrade/doctype/category/category.py | 81349bc3cd9dbd441491304734077aab10dca56f | # -*- coding: utf-8 -*-
# Copyright (c) 2018, Tridots Tech Pvt. Ltd. and contributors
# For license information, please see license.txt
from __future__ import unicode_literals
import frappe
from frappe.website.website_generator import WebsiteGenerator
class Category(WebsiteGenerator):
def validate(self):
if ' '... | [] |
TUDelft-AE-Python/ae1205-exercises | exercises/pyfiles/ex812_polarsincos.py | 342d1d567b64d3ccb3371ce9826c02a87a155fa8 | import matplotlib.pyplot as plt
import math
xtab = []
ytab = []
for i in range(0, 628):
# Calculate polar coordinates for provided equation
phi = float(i) / 100.0
r = 4 * math.cos(2 * phi)
# Convert to Cartesian and store in lists
x = r * math.cos(phi)
y = r * math.sin(phi)
xtab.append(x)... | [((341, 361), 'matplotlib.pyplot.plot', 'plt.plot', (['xtab', 'ytab'], {}), '(xtab, ytab)\n', (349, 361), True, 'import matplotlib.pyplot as plt\n'), ((362, 372), 'matplotlib.pyplot.show', 'plt.show', ([], {}), '()\n', (370, 372), True, 'import matplotlib.pyplot as plt\n'), ((186, 203), 'math.cos', 'math.cos', (['(2 * ... |
jgmize/kitsune | vendor/packages/logilab-astng/__pkginfo__.py | 8f23727a9c7fcdd05afc86886f0134fb08d9a2f0 | # Copyright (c) 2003-2010 LOGILAB S.A. (Paris, FRANCE).
# http://www.logilab.fr/ -- mailto:contact@logilab.fr
#
# This program is free software; you can redistribute it and/or modify it under
# the terms of the GNU Lesser General Public License as published by the Free Software
# Foundation; either version 2 of the Lic... | [((3016, 3045), 'os.path.join', 'join', (['"""test"""', '"""regrtest_data"""'], {}), "('test', 'regrtest_data')\n", (3020, 3045), False, 'from os.path import join\n'), ((3063, 3083), 'os.path.join', 'join', (['"""test"""', '"""data"""'], {}), "('test', 'data')\n", (3067, 3083), False, 'from os.path import join\n'), ((3... |
lmyybh/pytorch-networks | W-DCGAN/model.py | 8da055f5042c3803b275734afc89d33d239d7585 | import torch
import torch.nn as nn
class Generator(nn.Module):
def __init__(self, signal_size, out_channels=3):
super(Generator, self).__init__()
self.linear = nn.Linear(signal_size, 1024*4*4)
convs = []
channels = [1024, 512, 256, 128]
for i in range(1, len(channel... | [((181, 217), 'torch.nn.Linear', 'nn.Linear', (['signal_size', '(1024 * 4 * 4)'], {}), '(signal_size, 1024 * 4 * 4)\n', (190, 217), True, 'import torch.nn as nn\n'), ((667, 688), 'torch.nn.Sequential', 'nn.Sequential', (['*convs'], {}), '(*convs)\n', (680, 688), True, 'import torch.nn as nn\n'), ((1273, 1294), 'torch.n... |
bioShaun/omsCabinet | bioinformatics/analysis/rnaseq/prepare/split_gtf_by_type.py | 741179a06cbd5200662cd03bc2e0115f4ad06917 | import fire
import gtfparse
from pathlib import Path
GENCODE_CATEGORY_MAP = {
'IG_C_gene': 'protein_coding',
'IG_D_gene': 'protein_coding',
'IG_J_gene': 'protein_coding',
'IG_V_gene': 'protein_coding',
'IG_LV_gene': 'protein_coding',
'TR_C_gene': 'protein_coding',
'TR_J_gene': 'protein_cod... | [((3371, 3393), 'gtfparse.read_gtf', 'gtfparse.read_gtf', (['gtf'], {}), '(gtf)\n', (3388, 3393), False, 'import gtfparse\n'), ((3969, 3981), 'pathlib.Path', 'Path', (['outdir'], {}), '(outdir)\n', (3973, 3981), False, 'from pathlib import Path\n'), ((4318, 4338), 'fire.Fire', 'fire.Fire', (['split_gtf'], {}), '(split_... |
navel0810/chibi | rational.py | d2e9a791492352c3c1b76c841a3ad30df2f444fd | import math
class Q(object):
def __init__(self,a,b=1):
gcd=math.gcd(a,b)
self.a=a//gcd
self.b=b//gcd
def __repr__(self):
if self.b==1:
return str(self.a)
return f'{self.a}/{self.b}'
def __add__(self,q):
a=self.a
b=self.b... | [((76, 90), 'math.gcd', 'math.gcd', (['a', 'b'], {}), '(a, b)\n', (84, 90), False, 'import math\n')] |
jsandovalc/django-cities-light | cities_light/tests/test_import.py | a1c6af08938b7b01d4e12555bd4cb5040905603d | from __future__ import unicode_literals
import glob
import os
from dbdiff.fixture import Fixture
from .base import TestImportBase, FixtureDir
from ..settings import DATA_DIR
class TestImport(TestImportBase):
"""Load test."""
def test_single_city(self):
"""Load single city."""
fixture_dir = ... | [((743, 784), 'os.path.join', 'os.path.join', (['DATA_DIR', '"""angouleme_*.txt"""'], {}), "(DATA_DIR, 'angouleme_*.txt')\n", (755, 784), False, 'import os\n'), ((825, 837), 'os.remove', 'os.remove', (['f'], {}), '(f)\n', (834, 837), False, 'import os\n')] |
Cosik/HAHoymiles | custom_components/hoymiles/__init__.py | e956f8fafc4ae59d4c05755c6e8a5d5d7caa37f9 | import datetime
import logging
import voluptuous as vol
from homeassistant.components.sensor import PLATFORM_SCHEMA
from homeassistant.const import CONF_PASSWORD, CONF_USERNAME
import homeassistant.helpers.config_validation as cv
from .const import (
CONF_PLANT_ID,
)
_LOGGER = logging.getLogger(__name__)
MIN_T... | [((286, 313), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (303, 313), False, 'import logging\n'), ((342, 373), 'datetime.timedelta', 'datetime.timedelta', ([], {'seconds': '(600)'}), '(seconds=600)\n', (360, 373), False, 'import datetime\n'), ((431, 458), 'voluptuous.Required', 'vol.Re... |
bluebibi/flask_rest | views/auth.py | 9b1ee876060bca5d97459bb894c73530f66c4c15 | from flask import Blueprint, redirect, render_template, request, flash, session
from database import base
from database.base import User
from forms import UserForm, LoginForm, MyPageUserForm
from flask_login import login_required, login_user, logout_user, current_user
import requests
auth_blueprint = Blueprint('auth'... | [((304, 331), 'flask.Blueprint', 'Blueprint', (['"""auth"""', '__name__'], {}), "('auth', __name__)\n", (313, 331), False, 'from flask import Blueprint, redirect, render_template, request, flash, session\n'), ((450, 466), 'forms.MyPageUserForm', 'MyPageUserForm', ([], {}), '()\n', (464, 466), False, 'from forms import ... |
hplgit/fem-book | doc/.src/book/exer/cable_sin.py | c23099715dc3cb72e7f4d37625e6f9614ee5fc4e | import matplotlib.pyplot as plt
def model():
"""Solve u'' = -1, u(0)=0, u'(1)=0."""
import sympy as sym
x, c_0, c_1, = sym.symbols('x c_0 c_1')
u_x = sym.integrate(1, (x, 0, x)) + c_0
u = sym.integrate(u_x, (x, 0, x)) + c_1
r = sym.solve([u.subs(x,0) - 0,
sym.diff(u,x).subs(x... | [((132, 156), 'sympy.symbols', 'sym.symbols', (['"""x c_0 c_1"""'], {}), "('x c_0 c_1')\n", (143, 156), True, 'import sympy as sym\n'), ((643, 674), 'numpy.linspace', 'linspace', (['(dx / 2)', '(1 - dx / 2)', 'M'], {}), '(dx / 2, 1 - dx / 2, M)\n', (651, 674), False, 'from numpy import linspace\n'), ((1274, 1293), 'num... |
liuliu663/speaker-recognition-py3 | skgmm.py | 8fd0f77ac011e4a11c7cac751dc985b9cd1f2c4d | from sklearn.mixture import GaussianMixture
import operator
import numpy as np
import math
class GMMSet:
def __init__(self, gmm_order = 32):
self.gmms = []
self.gmm_order = gmm_order
self.y = []
def fit_new(self, x, label):
self.y.append(label)
gmm = GaussianM... | [((311, 342), 'sklearn.mixture.GaussianMixture', 'GaussianMixture', (['self.gmm_order'], {}), '(self.gmm_order)\n', (326, 342), False, 'from sklearn.mixture import GaussianMixture\n'), ((532, 543), 'math.exp', 'math.exp', (['i'], {}), '(i)\n', (540, 543), False, 'import math\n'), ((798, 820), 'operator.itemgetter', 'op... |
apcarrik/kaggle | duke-cs671-fall21-coupon-recommendation/outputs/rules/RF/12_features/numtrees_20/rule_6.py | 6e2d4db58017323e7ba5510bcc2598e01a4ee7bf | def findDecision(obj): #obj[0]: Passanger, obj[1]: Time, obj[2]: Coupon, obj[3]: Gender, obj[4]: Age, obj[5]: Education, obj[6]: Occupation, obj[7]: Bar, obj[8]: Coffeehouse, obj[9]: Restaurant20to50, obj[10]: Direction_same, obj[11]: Distance
# {"feature": "Age", "instances": 51, "metric_value": 0.9662, "depth": 1}
... | [] |
kennethwdk/PINet | lib/loss/__init__.py | 3a0abbd653146c56e39612384891c94c3fb49b35 | from .heatmaploss import HeatmapLoss
from .offsetloss import OffsetLoss
from .refineloss import RefineLoss | [] |
AndrewBezold/trinity | eth2/beacon/types/historical_batch.py | bc656da4dece431a0c929a99349d45faf75decf8 | from typing import Sequence
from eth.constants import ZERO_HASH32
from eth_typing import Hash32
import ssz
from ssz.sedes import Vector, bytes32
from eth2.configs import Eth2Config
from .defaults import default_tuple, default_tuple_of_size
class HistoricalBatch(ssz.Serializable):
fields = [("block_roots", Vec... | [((317, 335), 'ssz.sedes.Vector', 'Vector', (['bytes32', '(1)'], {}), '(bytes32, 1)\n', (323, 335), False, 'from ssz.sedes import Vector, bytes32\n'), ((354, 372), 'ssz.sedes.Vector', 'Vector', (['bytes32', '(1)'], {}), '(bytes32, 1)\n', (360, 372), False, 'from ssz.sedes import Vector, bytes32\n')] |
nikosk/fastAPI-microservice-example- | app/settings.py | a1a61ab4e521bc0c48eee5b3a755db134c098546 | import os
from pydantic import BaseSettings
class Settings(BaseSettings):
DEBUG: bool
DATABASE_URL: str
class Config:
env_file = os.getenv("CONFIG_FILE", ".env")
| [((153, 185), 'os.getenv', 'os.getenv', (['"""CONFIG_FILE"""', '""".env"""'], {}), "('CONFIG_FILE', '.env')\n", (162, 185), False, 'import os\n')] |
john-science/ADVECTOR | ADVECTOR/io_tools/create_bathymetry.py | 5c5ca7595c2c051f1a088b1f0e694936c3da3610 | import numpy as np
import xarray as xr
def create_bathymetry_from_land_mask(land_mask: xr.DataArray) -> xr.DataArray:
"""Method: identifies the lower depth bound of the shallowest
ocean cell (non-null) in each vertical grid column.
:param land_mask: dimensions {time, depth, lat, lon}, boloean array, T... | [((357, 385), 'numpy.all', 'np.all', (['(land_mask.depth <= 0)'], {}), '(land_mask.depth <= 0)\n', (363, 385), True, 'import numpy as np\n'), ((813, 837), 'numpy.diff', 'np.diff', (['land_mask.depth'], {}), '(land_mask.depth)\n', (820, 837), True, 'import numpy as np\n'), ((855, 975), 'numpy.concatenate', 'np.concatena... |
cr2630git/unitconvert | unitconvert/distance.py | 64a530f53b27a9412988877c7ae1b3b34f9ce8a6 | """
A simple python module for converting kilometers to miles or vice versa.
So simple that it doesn't even have any dependencies.
"""
def kilometers_to_miles(dist_in_km):
"""
Actually does the conversion of distance from km to mi.
PARAMETERS
--------
dist_in_km: float
A distance in kilometers.
RETURNS
-... | [] |
I-TECH-UW/mwachx | contacts/migrations_old/0006_data_status.py | e191755c3369208d678fceec68dbb4f5f51c453a | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
import itertools as it
from django.db import models, migrations
def convert_status(apps, schema_editor):
''' Migrate Visit.skipped and ScheduledPhoneCall.skipped -> status
(pending,missed,deleted,attended)
'''
Visit = apps.get_model(... | [((1395, 1449), 'django.db.migrations.RunPython', 'migrations.RunPython', (['convert_status', 'unconvert_status'], {}), '(convert_status, unconvert_status)\n', (1415, 1449), False, 'from django.db import models, migrations\n')] |
One-Green/plant-keeper-master | core/tests/test_base_time_range_controller.py | 67101a4cc7070d26fd1685631a710ae9a60fc5e8 | import os
import sys
from datetime import time
import unittest
sys.path.append(
os.path.dirname(
os.path.dirname(os.path.join("..", "..", "..", os.path.dirname("__file__")))
)
)
from core.controller import BaseTimeRangeController
class TestTimeRangeController(unittest.TestCase):
def test_time_ran... | [((797, 812), 'unittest.main', 'unittest.main', ([], {}), '()\n', (810, 812), False, 'import unittest\n'), ((349, 363), 'datetime.time', 'time', (['(10)', '(0)', '(0)'], {}), '(10, 0, 0)\n', (353, 363), False, 'from datetime import time\n'), ((381, 395), 'datetime.time', 'time', (['(12)', '(0)', '(0)'], {}), '(12, 0, 0... |
jurganson/spingen | generator_code/mp3_generator.py | f8421a26356d0cd1d94a0692846791eb45fce6f5 | from gtts import gTTS as ttos
from pydub import AudioSegment
import os
def generate_mp3 (segments, fade_ms, speech_gain, comment_fade_ms, language = "en", output_file_name = "generated_program_sound") :
def apply_comments (exercise_audio, segment) :
new_exercise_audio = exercise_audio
for comment ... | [((3853, 3879), 'os.path.exists', 'os.path.exists', (['"""./output"""'], {}), "('./output')\n", (3867, 3879), False, 'import os\n'), ((3890, 3910), 'os.mkdir', 'os.mkdir', (['"""./output"""'], {}), "('./output')\n", (3898, 3910), False, 'import os\n'), ((2220, 2256), 'pydub.AudioSegment.from_file', 'AudioSegment.from_f... |
deeplearninc/relaax | relaax/algorithms/ddpg/parameter_server.py | a0cf280486dc74dca3857c85ec0e4c34e88d6b2b | from __future__ import absolute_import
from relaax.server.parameter_server import parameter_server_base
from relaax.server.common import session
from . import ddpg_model
class ParameterServer(parameter_server_base.ParameterServerBase):
def init_session(self):
self.session = session.Session(ddpg_model.Sha... | [] |
nvoron23/brython | scripts/make_VFS.py | b1ce5fa39b5d38c0dde138b4e75723fbb3e574ab | # -*- coding: utf-8 -*-
import json
import os
import pyminifier
try:
import io as StringIO
except ImportError:
import cStringIO as StringIO # lint:ok
# Check to see if slimit or some other minification library is installed and
# Set minify equal to slimit's minify function.
try:
import slimit
js_mi... | [((665, 690), 'os.path.dirname', 'os.path.dirname', (['filename'], {}), '(filename)\n', (680, 690), False, 'import os\n'), ((3962, 3987), 'os.path.dirname', 'os.path.dirname', (['filename'], {}), '(filename)\n', (3977, 3987), False, 'import os\n'), ((6872, 6883), 'os.getcwd', 'os.getcwd', ([], {}), '()\n', (6881, 6883)... |
rcox771/spectrum_scanner | main.py | 71559d62ca9dc9f66d66b7ada4491de42c6cdd52 | from rtlsdr import RtlSdr
from contextlib import closing
from matplotlib import pyplot as plt
import numpy as np
from scipy.signal import spectrogram, windows
from scipy import signal
from skimage.io import imsave, imread
from datetime import datetime
import json
import os
from tqdm import tqdm
import time
from queue i... | [((450, 497), 'warnings.filterwarnings', 'warnings.filterwarnings', (['"""ignore"""'], {'category': 'cat'}), "('ignore', category=cat)\n", (473, 497), False, 'import warnings\n'), ((753, 793), 'tqdm.tqdm', 'tqdm', (['img_files'], {'desc': '"""splitting images"""'}), "(img_files, desc='splitting images')\n", (757, 793),... |
donbowman/rdflib | test/__init__.py | c1be731c8e6bbe997cc3f25890bbaf685499c517 | #
import os
TEST_DIR = os.path.abspath(os.path.dirname(__file__))
| [((40, 65), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (55, 65), False, 'import os\n')] |
braingineer/pyromancy | examples/mnist1.py | 7a7ab1a6835fd63b9153463dd08bb53630f15c62 | from __future__ import print_function
import argparse
import os
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.autograd import Variable
from torchvision import datasets, transforms
from tqdm import tqdm
from pyromancy import pyromq
from pyromancy.losses import LossGroup, NegativeLogLik... | [((485, 545), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""PyTorch MNIST Example"""'}), "(description='PyTorch MNIST Example')\n", (508, 545), False, 'import argparse\n'), ((2616, 2631), 'pyromancy.pyromq.Broker', 'pyromq.Broker', ([], {}), '()\n', (2629, 2631), False, 'from pyromancy ... |
matthewklinko/openpilot | selfdrive/locationd/calibrationd.py | b0563a59684d0901f99abbb58ac1fbd729ded1f9 | #!/usr/bin/env python
import os
import copy
import json
import numpy as np
import selfdrive.messaging as messaging
from selfdrive.locationd.calibration_helpers import Calibration
from selfdrive.swaglog import cloudlog
from common.params import Params
from common.transformations.model import model_height
from common.tra... | [] |
datastax-labs/hunter | hunter/main.py | 3631cc3fa529991297a8b631bbae15b138cce307 | import argparse
import copy
import logging
import sys
from dataclasses import dataclass
from datetime import datetime, timedelta
from slack_sdk import WebClient
from typing import Dict, Optional, List
import pytz
from hunter import config
from hunter.attributes import get_back_links
from hunter.config import ConfigEr... | [((14875, 14889), 'hunter.data_selector.DataSelector', 'DataSelector', ([], {}), '()\n', (14887, 14889), False, 'from hunter.data_selector import DataSelector\n'), ((17254, 17271), 'hunter.series.AnalysisOptions', 'AnalysisOptions', ([], {}), '()\n', (17269, 17271), False, 'from hunter.series import AnalysisOptions, Ch... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.