repo_name stringlengths 7 94 | repo_path stringlengths 4 237 | repo_head_hexsha stringlengths 40 40 | content stringlengths 10 680k | apis stringlengths 2 840k |
|---|---|---|---|---|
jeremyng123/pytm | pytm/__init__.py | e0bbbbbcfa387887753e27f78678c6004edf0e85 | __all__ = ['Element', 'Server', 'ExternalEntity', 'Datastore', 'Actor', 'Process', 'SetOfProcesses', 'Dataflow', 'Boundary', 'TM', 'Action', 'Lambda', 'Threat']
from .pytm import Element, Server, ExternalEntity, Dataflow, Datastore, Actor, Process, SetOfProcesses, Boundary, TM, Action, Lambda, Threat
| [] |
6un9-h0-Dan/malchive | malchive/utilities/comguidtoyara.py | 1d150430559a307cdfee49d47799c95caea47415 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright(c) 2021 The MITRE Corporation. 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/lice... | [((31, 6, 31, 33), 'logging.getLogger', 'logging.getLogger', ({(31, 24, 31, 32): '__name__'}, {}), '(__name__)', False, 'import logging\n'), ((50, 11, 50, 35), 're.sub', 're.sub', ({(50, 18, 50, 25): '"""[{}-]"""', (50, 27, 50, 29): '""""""', (50, 31, 50, 34): 'iid'}, {}), "('[{}-]', '', iid)", False, 'import re\n'), (... |
sis0truk/pretrained-models.pytorch | examples/voc2007_extract.py | 4aea6d47996279b4b281355ca3d9738d0dff7469 | import os
import argparse
from tqdm import tqdm
import torch
from torch.autograd import Variable
from torch.utils import model_zoo
# http://scikit-learn.org
from sklearn.metrics import accuracy_score
from sklearn.metrics import average_precision_score
from sklearn.svm import LinearSVC
from sklearn.svm import SVC
imp... | [] |
tani-cat/point_maximizer | main.py | c9ff868377bbeed4727914d7be258457dc8295a3 | import csv
import os
from collections import deque
BASE_DIR = os.path.dirname(os.path.abspath(__file__))
INPUT_PATH = os.path.join(BASE_DIR, 'goods_source.csv')
OUTPUT_PATH = os.path.join(BASE_DIR, 'result.csv')
FILE_ENCODE = 'shift_jis'
INPUT_COLS = ('id', 'goods_name', 'price')
def import_csv():
"""入力データの読み込... | [((7, 13, 7, 55), 'os.path.join', 'os.path.join', ({(7, 26, 7, 34): 'BASE_DIR', (7, 36, 7, 54): '"""goods_source.csv"""'}, {}), "(BASE_DIR, 'goods_source.csv')", False, 'import os\n'), ((8, 14, 8, 50), 'os.path.join', 'os.path.join', ({(8, 27, 8, 35): 'BASE_DIR', (8, 37, 8, 49): '"""result.csv"""'}, {}), "(BASE_DIR, 'r... |
gspu/bitkeeper | src/gui/tcltk/tcl/tests/langbench/proc.py | 994fb651a4045b221e33703fc3d665c3a34784e1 | #!/usr/bin/python
def a(val):
return b(val)
def b(val):
return c(val)
def c(val):
return d(val)
def d(val):
return e(val)
def e(val):
return f(val)
def f(val):
return g(val, 2)
def g(v1, v2):
return h(v1, v2, 3)
def h(v1, v2, v3):
return i(v1, v2, v3, 4)
def i(v1, v2, v3, v4):
return j(v1, v2, v3, v4, 5)
d... | [] |
dmitryrubtsov/Recommender-systems | src/metrics.py | 9debd7b1c2d67ebc508263a483c81da57521dea0 | import pandas as pd
import numpy as np
import swifter
def money_precision_at_k(y_pred: pd.Series, y_true: pd.Series, item_price, k=5):
y_pred = y_pred.swifter.progress_bar(False).apply(pd.Series)
user_filter = ~(y_true.swifter.progress_bar(False).apply(len) < k)
y_pred = y_pred.loc[user_filter]
y_tru... | [((15, 35, 15, 48), 'numpy.array', 'np.array', ({(15, 44, 15, 47): 'row'}, {}), '(row)', True, 'import numpy as np\n')] |
upupming/dragon | diff_r_b.py | 245f71996004b386ae764eb8f76603233d8a6763 | import numpy as np
size = 9
percentage_max = 0.08
xis = np.linspace(0.1 * (1-percentage_max), 0.1 * (1+percentage_max), size)
E_n = [
85219342462.9973,
85219254693.4412,
85219173007.4296,
85219096895.7433,
85219025899.6604,
85218959605.1170,
85218897637.6421,
85218839657.9502,
85218785358.0968
]
percentage ... | [((5, 6, 5, 75), 'numpy.linspace', 'np.linspace', ({(5, 18, 5, 42): '0.1 * (1 - percentage_max)', (5, 44, 5, 68): '0.1 * (1 + percentage_max)', (5, 70, 5, 74): 'size'}, {}), '(0.1 * (1 - percentage_max), 0.1 * (1 + percentage_max), size)', True, 'import numpy as np\n'), ((19, 13, 19, 27), 'numpy.empty', 'np.empty', ({(... |
rhiga2/mturk-tsep-test | src/run.py | 2cc4388442bc9155022d28ec9132acc10a1b82f7 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from caqe import app
app.run(debug=True, threaded=True) | [((5, 0, 5, 34), 'caqe.app.run', 'app.run', (), '', False, 'from caqe import app\n')] |
bopopescu/hydra | src/main/python/hydra/lib/cli.py | ec0793f8c1f49ceb93bf1f1a9789085b68d55f08 | """hydra cli.
Usage:
hydra cli ls slaves
hydra cli ls apps
hydra cli ls task <app>
hydra cli [force] stop <app>
hydra cli scale <app> <scale>
hydra cli (-h | --help)
hydra cli --version
Options:
-h --help Show this screen.
--version Show version.
"""
__author__ = 'sushil'
from docopt imp... | [((32, 4, 32, 42), 'hydra.lib.util.createlogger', 'util.createlogger', ({(32, 22, 32, 27): '"""cli"""', (32, 29, 32, 41): 'logging.INFO'}, {}), "('cli', logging.INFO)", False, 'from hydra.lib import util, mmapi\n'), ((37, 13, 37, 27), 'configparser.ConfigParser', 'ConfigParser', ({}, {}), '()', False, 'from configparse... |
doggy8088/azure-devops-cli-extension | azure-devops/azext_devops/test/common/test_format.py | 2f6b1a6ffbc49ae454df640a8bb00dac991d6514 | # --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------... | [((40, 4, 40, 19), 'unittest.main', 'unittest.main', ({}, {}), '()', False, 'import unittest\n'), ((14, 17, 14, 44), 'azext_devops.dev.common.format.trim_for_display', 'trim_for_display', ({(14, 34, 14, 39): 'input', (14, 41, 14, 43): '20'}, {}), '(input, 20)', False, 'from azext_devops.dev.common.format import trim_fo... |
aantr/WindowsHostManager | github/GitReleaseAsset.py | 75d248fc8991d471c6802fa79e7dee44a5708c65 | ############################ Copyrights and license ############################
# #
# Copyright 2017 Chris McBride <thehighlander@users.noreply.github.com> #
# Copyright 2017 Simon <spam@esemi.ru> ... | [] |
epenet/samsung-tv-ws-api | tests/test_remote.py | 23e0cf8188ba16ab128cff40fc56358cc2167ead | """Tests for remote module."""
from unittest.mock import Mock, call, patch
from samsungtvws.remote import SamsungTVWS
def test_send_key(connection: Mock) -> None:
"""Ensure simple data can be parsed."""
open_response = (
'{"data": {"token": 123456789}, "event": "ms.channel.connect", "from": "host"}'
... | [((14, 9, 14, 33), 'samsungtvws.remote.SamsungTVWS', 'SamsungTVWS', ({(14, 21, 14, 32): '"""127.0.0.1"""'}, {}), "('127.0.0.1')", False, 'from samsungtvws.remote import SamsungTVWS\n'), ((34, 9, 34, 33), 'samsungtvws.remote.SamsungTVWS', 'SamsungTVWS', ({(34, 21, 34, 32): '"""127.0.0.1"""'}, {}), "('127.0.0.1')", False... |
chm-dev/amazfitGTSwatchfaceBundle | src/utils/pythonSrc/watchFaceParser/models/elements/battery/batteryGaugeElement.py | 4cb04be5215de16628418e9b38152a35d5372d3e | import logging
from watchFaceParser.models.elements.common.imageSetElement import ImageSetElement
class BatteryGaugeElement(ImageSetElement):
def __init__(self, parameter, parent, name = None):
super(BatteryGaugeElement, self).__init__(parameter = parameter, parent = parent, name = name)
def draw3(s... | [] |
JoseRoman/IndicoIo-python | indicoio/utils/__init__.py | 4fe2952df45c26392f36acd8b43391dfc50e140b | import inspect
import numpy as np
class TypeCheck(object):
"""
Decorator that performs a typecheck on the input to a function
"""
def __init__(self, accepted_structures, arg_name):
"""
When initialized, include list of accepted datatypes and the
arg_name to enforce the check on.... | [((71, 16, 71, 45), 'numpy.power', 'np.power', ({(71, 25, 71, 30): 'array', (71, 32, 71, 44): 'distribution'}, {}), '(array, distribution)', True, 'import numpy as np\n'), ((76, 20, 76, 33), 'numpy.max', 'np.max', ({(76, 27, 76, 32): 'array'}, {}), '(array)', True, 'import numpy as np\n'), ((76, 35, 76, 48), 'numpy.min... |
ProzorroUKR/openprocurement.tender.openuadefense | openprocurement/tender/openuadefense/tests/tender.py | 5d6a7433839178edba35015ae614ba3e36b29d0b | # -*- coding: utf-8 -*-
import unittest
from openprocurement.api.tests.base import snitch
from openprocurement.api.tests.base import BaseWebTest
from openprocurement.tender.belowthreshold.tests.base import test_lots
from openprocurement.tender.belowthreshold.tests.tender import TenderResourceTestMixin
from openprocur... | [((44, 29, 44, 54), 'openprocurement.api.tests.base.snitch', 'snitch', ({(44, 36, 44, 53): 'simple_add_tender'}, {}), '(simple_add_tender)', False, 'from openprocurement.api.tests.base import snitch\n'), ((52, 25, 52, 46), 'openprocurement.api.tests.base.snitch', 'snitch', ({(52, 32, 52, 45): 'empty_listing'}, {}), '(e... |
jmilhone/fabry_perot | fabry/tools/file_io.py | cd3cb7a1dbcaa3c9382f9f2dbd3407d95447b3ce | from __future__ import print_function, division
import os
import numpy as np
import h5py
def dict_2_h5(fname, dic, append=False):
'''Writes a dictionary to a hdf5 file with given filename
It will use lzf compression for all numpy arrays
Args:
fname (str): filename to write to
dic (dic... | [((44, 7, 44, 26), 'os.path.isdir', 'os.path.isdir', ({(44, 21, 44, 25): 'path'}, {}), '(path)', False, 'import os\n'), ((103, 12, 103, 71), 'os.path.join', 'os.path.join', ({(103, 25, 103, 42): 'finesse_directory', (103, 44, 103, 70): '"""F_post_equal_weights.dat"""'}, {}), "(finesse_directory, 'F_post_equal_weights.d... |
lucaspompeun/metodos-matematicos-aplicados-nas-engenharias-via-sistemas-computacionais | derivadas.py | 008d397f76a935af1aba530cc0134b9dd326d3ac | # -*- coding: utf-8 -*-
"""
Created on Sat Mar 23 21:57:48 2019
INSTITUTO FEDERAL DE EDUCAÇÃO, CIÊNCIA E TECNOLOGIA DO PÁRA - IFPA ANANINDEUA
@author:
Prof. Dr. Denis C. L. Costa
Discentes:
Heictor Alves de Oliveira Costa
Lucas Pompeu Neves
Grupo... | [((35, 4, 35, 19), 'sympy.symbols', 'sy.symbols', ({(35, 15, 35, 18): '"""x"""'}, {}), "('x')", True, 'import sympy as sy\n')] |
haotianzhu/C_Questions_Solutions | trapping_rain_water/solution.py | 2677b6d26bedb9bc6c6137a2392d0afaceb91ec2 | class Solution:
def trap(self, height):
"""
:type height: List[int]
:rtype: int
"""
if not height:
return 0
left = 0
right = len(height)-1
total_area = 0
if height[left] <= height[right]:
m = left
else:
m =right
while(left < right):
if height[left] <= height[right]:
# move m... | [] |
yu9824/AtCoder | ABC/178/D.py | 50a209059c005efadc1c912e443ec41365381c16 | # list(map(int, input().split()))
# int(input())
import sys
sys.setrecursionlimit(10 ** 9)
'''
DP
A[n] = A[n-3] + A[n-4] + ... + A[0] (O(S**2))
ここで,A[n-1] = A[n-4] + A[n-5] + ... + A[0]より,
A[n] = A[n-3] + A[n-1]とも表せる.(O(S)でより高速.)
'''
mod = 10 ** 9 + 7
def main(*args):
S = args[0]
A = [0 for s in range(S+1)]... | [((5, 0, 5, 30), 'sys.setrecursionlimit', 'sys.setrecursionlimit', ({(5, 22, 5, 29): '(10 ** 9)'}, {}), '(10 ** 9)', False, 'import sys\n')] |
OzanCKN/OpenMDAO-Framework | contrib/analysis_server/src/analysis_server/factory.py | 05e9d4b9bc41d0ec00a7073545146c925cd33b0b | from openmdao.main.factory import Factory
from analysis_server import client, proxy, server
class ASFactory(Factory):
"""
Factory for components running under an AnalysisServer.
An instance would typically be passed to
:meth:`openmdao.main.factorymanager.register_class_factory`.
host: string
... | [((23, 23, 23, 48), 'analysis_server.client.Client', 'client.Client', ({(23, 37, 23, 41): 'host', (23, 43, 23, 47): 'port'}, {}), '(host, port)', False, 'from analysis_server import client, proxy, server\n'), ((48, 27, 48, 80), 'analysis_server.proxy.ComponentProxy', 'proxy.ComponentProxy', ({(48, 48, 48, 55): 'typname... |
zinaukarenku/zkr-platform | web/migrations/0007_auto_20180824_0925.py | 8daf7d1206c482f1f8e0bcd54d4fde783e568774 | # Generated by Django 2.1 on 2018-08-24 09:25
from django.db import migrations, models
import web.models
class Migration(migrations.Migration):
dependencies = [
('web', '0006_organizationmember_user'),
]
operations = [
migrations.AlterField(
model_name='organizationpartner',... | [((17, 18, 17, 109), 'django.db.models.ImageField', 'models.ImageField', (), '', False, 'from django.db import migrations, models\n')] |
SaurabhAgarwala/antlir | antlir/bzl/image_actions/tarball.bzl | d9513d35d3eaa9d28717a40057a14d099c6ec775 | # Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
load("//antlir/bzl:maybe_export_file.bzl", "maybe_export_file")
load("//antlir/bzl:shape.bzl", "shape")
load(
"//antlir/bzl:target_tagger.... | [] |
haobtc/sqlmat | sqlmat/utils.py | c6b6ef966ba01173b6a485afb932ed438c35b211 | from typing import Tuple, List, Optional
import json
import sys
import os
import shlex
import asyncio
import argparse
import logging
import tempfile
from urllib.parse import urlparse
logger = logging.getLogger(__name__)
def find_sqlmat_json() -> Optional[dict]:
json_path = os.getenv('SQLMAT_JSON_PATH')
if jso... | [((12, 9, 12, 36), 'logging.getLogger', 'logging.getLogger', ({(12, 27, 12, 35): '__name__'}, {}), '(__name__)', False, 'import logging\n'), ((15, 16, 15, 45), 'os.getenv', 'os.getenv', ({(15, 26, 15, 44): '"""SQLMAT_JSON_PATH"""'}, {}), "('SQLMAT_JSON_PATH')", False, 'import os\n'), ((38, 13, 40, 25), 'argparse.Argume... |
young-geng/UVaClient | submit.py | 8ff4a368ac8f0395248292a0d903047a074752ed | import requests
from sys import stderr
import re
def submit(session, problem_id, language, source):
language_code = {
'c': 1,
'java': 2,
'c++': 3,
'pascal': 4,
'c++11': 5
}
url = "http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=25&page=save_submission"
data = {
'problemid': '',
... | [] |
adagj/ECS_SOconvection | FIGURE4/eddymoc_scripts/noresm_cesm_eddymoc_150yrs.py | d1bb935b37380f11e021a463c6a807d7527220a6 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
@author: Ada Gjermundsen
year: 2019 - 2021
This script is used to calculate the eddy-induced overturning in CESM2 and NorESM2 (LM and MM) south of 50S
for the CMIP experiments piControl and abrupt-4xCO2 after 150
the average time is 30 years
The result is used in FIGU... | [((13, 0, 13, 63), 'sys.path.insert', 'sys.path.insert', ({(13, 16, 13, 17): '(1)', (13, 19, 13, 62): '"""/scratch/adagj/CMIP6/CLIMSENS/CMIP6_UTILS"""'}, {}), "(1, '/scratch/adagj/CMIP6/CLIMSENS/CMIP6_UTILS')", False, 'import sys\n'), ((20, 0, 20, 31), 'warnings.simplefilter', 'warnings.simplefilter', ({(20, 22, 20, 30... |
KnowledgeCaptureAndDiscovery/wings-client | wings/planner.py | af1d068f4adc07d9060afa94dc99e0b2565be088 | import json
import re
class Planner(object):
def __init__(self, api_client):
self.api_client = api_client
def set_template(self, template):
self.wflowns = self.api_client.get_export_url() + "workflows/" + template + ".owl#"
self.wflowid = self.wflowns + template
def _set_binding... | [((78, 16, 78, 35), 're.compile', 're.compile', ({(78, 27, 78, 34): '"""^.*#"""'}, {}), "('^.*#')", False, 'import re\n'), ((108, 16, 108, 35), 're.compile', 're.compile', ({(108, 27, 108, 34): '"""^.*#"""'}, {}), "('^.*#')", False, 'import re\n'), ((101, 20, 101, 52), 'json.dumps', 'json.dumps', ({(101, 31, 101, 51): ... |
salayhin/talkofacta | eggs/ZConfig-3.0.4-py2.7.egg/ZConfig/tests/test_cookbook.py | 8b5a14245dd467bb1fda75423074c4840bd69fb7 | ##############################################################################
#
# Copyright (c) 2004 Zope Foundation and Contributors.
# All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOF... | [((67, 11, 67, 47), 'unittest.makeSuite', 'unittest.makeSuite', ({(67, 30, 67, 46): 'CookbookTestCase'}, {}), '(CookbookTestCase)', False, 'import unittest\n'), ((70, 4, 70, 43), 'unittest.main', 'unittest.main', (), '', False, 'import unittest\n')] |
ResearchHub/ResearchHub-Backend-Open | src/bullet_point/migrations/0006_bulletpoint_sift_risk_score.py | d36dca33afae2d442690694bb2ab17180d84bcd3 | # Generated by Django 2.2 on 2020-11-07 01:03
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('bullet_point', '0005_bulletpoint_created_location'),
]
operations = [
migrations.AddField(
model_name='bulletpoint',
n... | [((16, 18, 16, 58), 'django.db.models.FloatField', 'models.FloatField', (), '', False, 'from django.db import migrations, models\n')] |
ezhkovskii/instagrapi-rest | main.py | a3570f279ef0973856b92e433b117e0be0d4c713 | import pkg_resources
from fastapi import FastAPI
from fastapi.openapi.utils import get_openapi
from starlette.responses import RedirectResponse, JSONResponse
from routers import auth, media, video, photo, user, igtv, clip, album, story, hashtag, direct
app = FastAPI()
app.include_router(auth.router)
app.include_route... | [((8, 6, 8, 15), 'fastapi.FastAPI', 'FastAPI', ({}, {}), '()', False, 'from fastapi import FastAPI\n'), ((25, 11, 25, 40), 'starlette.responses.RedirectResponse', 'RedirectResponse', (), '', False, 'from starlette.responses import RedirectResponse, JSONResponse\n'), ((55, 21, 60, 5), 'fastapi.openapi.utils.get_openapi'... |
suet-lee/mycelium | scripts/run_d435.py | db83cd3ab00697f28b2def2cebcdef52698fdd92 | #!/usr/bin/env python3
from mycelium import CameraD435
from mycelium_utils import Scripter
class ScripterExt(Scripter):
def run_main(self):
self.camera = CameraD435(
configuration_mode=self.cfg.d435['configuration_mode'],
enable_rgb_stream=self.cfg.d435['enable_rgb_stream'],
... | [((9, 22, 16, 71), 'mycelium.CameraD435', 'CameraD435', (), '', False, 'from mycelium import CameraD435\n')] |
pi-top/pi-top-Python-SDK | examples/system/miniscreen/miniscreen_display_animated_image_once_simple_way.py | 6c83cc5f612d77f86f8d391c7f2924a28f7b1232 | from PIL import Image
from pitop import Pitop
pitop = Pitop()
miniscreen = pitop.miniscreen
rocket = Image.open("/usr/lib/python3/dist-packages/pitop/miniscreen/images/rocket.gif")
miniscreen.play_animated_image(rocket)
| [((5, 8, 5, 15), 'pitop.Pitop', 'Pitop', ({}, {}), '()', False, 'from pitop import Pitop\n'), ((8, 9, 8, 88), 'PIL.Image.open', 'Image.open', ({(8, 20, 8, 87): '"""/usr/lib/python3/dist-packages/pitop/miniscreen/images/rocket.gif"""'}, {}), "('/usr/lib/python3/dist-packages/pitop/miniscreen/images/rocket.gif')", False,... |
nemami/synbioinformatica | synbioinformatica.py | 9306d7a7edb93aaa8e4de5e041db6633214c07b1 | #!/usr/bin/python -tt
import sys, re, math
from decimal import *
# TODO: work on naming scheme
# TODO: add more ORIs
# TODO: assemblytree alignment
# TODO: Wobble, SOEing
# TODO: (digestion, ligation) redundant products
# TODO: for PCR and Sequencing, renormalize based on LCS
# TODO: tutorials
dna_alphabet = {'A':'A... | [] |
jasonszang/scriptd | scriptd/app/flask_helper.py | e612f10971ca5d98ffff7e0680485575792529e7 | # -*- coding: UTF-8 -*-
"""Helper for working with flask"""
import logging
from flask import Flask
from flask import request
from typing import Text
class FlaskHelper(object):
"""
Helper class for interacting with flask framework.
Improves testability by avoiding accessing flask global/thread-local objec... | [((26, 15, 26, 33), 'flask.request.get_data', 'request.get_data', ({}, {}), '()', False, 'from flask import request\n')] |
aymericvie/evology | evology/research/MCarloLongRuns/Exp1_WSvsReturn.py | 8f00d94dee7208be5a5bdd0375a9d6ced25097f4 | # Imports
import numpy as np
import pandas as pd
import sys
import tqdm
import warnings
import time
import ternary
from ternary.helpers import simplex_iterator
import multiprocessing as mp
warnings.simplefilter("ignore")
if sys.platform == "darwin":
sys.path.append("/Users/aymericvie/Documents/GitHub/evology/evol... | [((12, 0, 12, 31), 'warnings.simplefilter', 'warnings.simplefilter', ({(12, 22, 12, 30): '"""ignore"""'}, {}), "('ignore')", False, 'import warnings\n'), ((22, 12, 22, 23), 'time.time', 'time.time', ({}, {}), '()', False, 'import time\n'), ((15, 4, 15, 78), 'sys.path.append', 'sys.path.append', ({(15, 20, 15, 77): '"""... |
vinisantos7/PythonExercicios | ex039.py | bc8f38e03a606d6b0216632a93affeab0792e534 | print("@"*30)
print("Alistamento - Serviço Militar")
print("@"*30)
from datetime import date
ano_nasc = int(input("Digite seu ano de nascimento: "))
ano_atual = date.today().year
idade = ano_atual - ano_nasc
print(f"Quem nasceu em {ano_nasc} tem {idade} anos em {ano_atual}")
if idade == 18:
print("É a hora de se... | [((8, 12, 8, 24), 'datetime.date.today', 'date.today', ({}, {}), '()', False, 'from datetime import date\n')] |
Jaimie-Jin1/streamsx.topology | test/python/spl/tk17/opt/.__splpy/packages/streamsx/topology/tester.py | 6f316ec8e9ed1349c6f061d9bb7d03deb87e3d08 | # coding=utf-8
# Licensed Materials - Property of IBM
# Copyright IBM Corp. 2017
"""Testing support for streaming applications.
Allows testing of a streaming application by creation conditions
on streams that are expected to become valid during the processing.
`Tester` is designed to be used with Python's `unittest` ... | [((76, 10, 76, 53), 'logging.getLogger', 'logging.getLogger', ({(76, 28, 76, 52): '"""streamsx.topology.test"""'}, {}), "('streamsx.topology.test')", False, 'import logging\n'), ((161, 24, 161, 69), 'os.getenv', 'os.getenv', ({(161, 34, 161, 52): '"""STREAMS_USERNAME"""', (161, 54, 161, 68): '"""streamsadmin"""'}, {}),... |
Curly-Mo/piglatin | piglatin_microservice/views/main.py | 9ea4a7533675bcb5b28f708beda18f175e0a9fe4 | from flask import request, jsonify, Blueprint
from .. import piglatin
main = Blueprint('main', __name__)
@main.route('/', methods=['GET', 'POST'])
def index():
response = """
Please use the endpoint /translate to access this api.
Usage: "{}translate?text=Translate+this+text+into+Piglatin."
... | [((7, 7, 7, 34), 'flask.Blueprint', 'Blueprint', ({(7, 17, 7, 23): '"""main"""', (7, 25, 7, 33): '__name__'}, {}), "('main', __name__)", False, 'from flask import request, jsonify, Blueprint\n'), ((21, 11, 21, 35), 'flask.request.args.get', 'request.args.get', ({(21, 28, 21, 34): '"""text"""'}, {}), "('text')", False, ... |
sumanentc/Python-Projects | projects/pong-game/pong.py | 11c763fcbe4e088928bd56c28f767b93ae73984d | from turtle import Screen
from paddle import Paddle
from ball import Ball
import time
from scoreboard import ScoreBoard
screen = Screen()
screen.bgcolor('black')
screen.setup(width=800, height=600)
screen.title('pong')
# Turn off animation to show paddle after it has been shifted
screen.tracer(0)
right_paddle = Pad... | [((8, 9, 8, 17), 'turtle.Screen', 'Screen', ({}, {}), '()', False, 'from turtle import Screen\n'), ((16, 15, 16, 29), 'paddle.Paddle', 'Paddle', ({(16, 22, 16, 25): '350', (16, 27, 16, 28): '0'}, {}), '(350, 0)', False, 'from paddle import Paddle\n'), ((17, 14, 17, 29), 'paddle.Paddle', 'Paddle', ({(17, 21, 17, 25): '-... |
brad-h/expy | ExPy/ExPy/module20.py | d3f3dfbbdae31ab8c7e134a5ce9d5f6adf94b516 | """ Multistate Sales Tax Calculator """
import os
from decimal import Decimal
from decimal import InvalidOperation
def prompt_decimal(prompt):
""" Using the prompt, attempt to get a decimal from the user """
while True:
try:
return Decimal(input(prompt))
except InvalidOperation:
... | [((23, 16, 23, 31), 'decimal.Decimal', 'Decimal', ({(23, 24, 23, 30): '"""0.08"""'}, {}), "('0.08')", False, 'from decimal import Decimal\n'), ((24, 10, 24, 25), 'decimal.Decimal', 'Decimal', ({(24, 18, 24, 24): '"""0.08"""'}, {}), "('0.08')", False, 'from decimal import Decimal\n'), ((25, 17, 25, 32), 'decimal.Decimal... |
psmsmets/pyVDMS | pyvdms/util/verify.py | cb3db93b655d3a02ae3aa1fdd418ae70dd249271 | r"""
:mod:`util.verify` -- Input verification
========================================
Common input verification methods.
"""
# Mandatory imports
import numpy as np
__all__ = ['verify_tuple_range']
def verify_tuple_range(
input_range: tuple, allow_none: bool = True, name: str = None,
step: bool = None, ... | [((71, 11, 71, 42), 'numpy.sign', 'np.sign', ({(71, 19, 71, 41): "(r['last'] - r['first'])"}, {}), "(r['last'] - r['first'])", True, 'import numpy as np\n'), ((71, 46, 71, 64), 'numpy.sign', 'np.sign', ({(71, 54, 71, 63): "r['step']"}, {}), "(r['step'])", True, 'import numpy as np\n')] |
reneraab/librephotos | api/image_similarity.py | a3972ab520586e721c67f283b1a50ccb7abe2b01 | import numpy as np
import requests
from django.db.models import Q
from api.models import Photo, User
from api.util import logger
from ownphotos.settings import IMAGE_SIMILARITY_SERVER
def search_similar_embedding(user, emb, result_count=100, threshold=27):
if type(user) == int:
user_id = user
else:
... | [((16, 22, 16, 53), 'numpy.array', 'np.array', (), '', True, 'import numpy as np\n'), ((24, 10, 24, 77), 'requests.post', 'requests.post', (), '', False, 'import requests\n'), ((43, 22, 43, 71), 'numpy.array', 'np.array', (), '', True, 'import numpy as np\n'), ((46, 10, 46, 77), 'requests.post', 'requests.post', (), ''... |
webdevhub42/Lambda | WEEKS/CD_Sata-Structures/_MISC/misc-examples/python3-book-examples/struct/struct_endianness.py | b04b84fb5b82fe7c8b12680149e25ae0d27a0960 | #
"""
"""
# end_pymotw_header
import struct
import binascii
values = (1, "ab".encode("utf-8"), 2.7)
print("Original values:", values)
endianness = [
("@", "native, native"),
("=", "native, standard"),
("<", "little-endian"),
(">", "big-endian"),
("!", "network"),
]
for code, name in endianness:... | [((22, 8, 22, 39), 'struct.Struct', 'struct.Struct', ({(22, 22, 22, 38): "code + ' I 2s f'"}, {}), "(code + ' I 2s f')", False, 'import struct\n'), ((27, 30, 27, 59), 'binascii.hexlify', 'binascii.hexlify', ({(27, 47, 27, 58): 'packed_data'}, {}), '(packed_data)', False, 'import binascii\n')] |
GuillaumeVandekerckhove/pydov | pydov/util/net.py | b51f77bf93d1f9e96dd39edf564d95426da04126 | # -*- coding: utf-8 -*-
"""Module grouping network-related utilities and functions."""
from queue import Empty, Queue
from threading import Thread
import requests
import urllib3
from requests.adapters import HTTPAdapter
import pydov
request_timeout = 300
class TimeoutHTTPAdapter(HTTPAdapter):
"""HTTPAdapter w... | [((64, 18, 64, 36), 'requests.Session', 'requests.Session', ({}, {}), '()', False, 'import requests\n'), ((104, 27, 104, 45), 'queue.Queue', 'Queue', (), '', False, 'from queue import Empty, Queue\n'), ((105, 28, 105, 35), 'queue.Queue', 'Queue', ({}, {}), '()', False, 'from queue import Empty, Queue\n')] |
yiunsr/flask_labstoo_base | app/main/views.py | ec99a7c955bd0bd9d96959c1c26cbd0e5ec23796 | from flask.helpers import make_response
from flask.templating import render_template
from . import main
@main.route('/', methods=['GET', 'POST'])
@main.route('/index', methods=['GET', 'POST'])
def index():
resp = make_response(
render_template('main/index.html'))
return resp
| [((10, 8, 10, 42), 'flask.templating.render_template', 'render_template', ({(10, 24, 10, 41): '"""main/index.html"""'}, {}), "('main/index.html')", False, 'from flask.templating import render_template\n')] |
abamaj/SBOL-to-Excel | SBOL2Excel/utils/sbol2excel.py | 790ef5242990c06b20dcb8e207def8e4527aea02 | import sbol2
import pandas as pd
import os
import logging
from openpyxl import load_workbook
from openpyxl.worksheet.table import Table, TableStyleInfo
from openpyxl.utils.dataframe import dataframe_to_rows
from openpyxl.styles import Font, PatternFill, Border, Side
from requests_html import HTMLSession
#wasderivedfro... | [((24, 34, 24, 59), 'os.path.dirname', 'os.path.dirname', ({(24, 50, 24, 58): '__file__'}, {}), '(__file__)', False, 'import os\n'), ((25, 21, 25, 77), 'os.path.join', 'os.path.join', ({(25, 34, 25, 57): 'self.file_location_path', (25, 59, 25, 76): '"""ontologies.xlsx"""'}, {}), "(self.file_location_path, 'ontologies.x... |
akshay-ap/ocean.py | ocean_lib/models/data_token.py | 1dab70d164ca36a6cff284e8be82ae04344ad13f | #
# Copyright 2021 Ocean Protocol Foundation
# SPDX-License-Identifier: Apache-2.0
#
import json
import os
import time
from collections import namedtuple
import requests
from eth_utils import remove_0x_prefix
from ocean_lib.data_provider.data_service_provider import DataServiceProvider
from ocean_lib.enforce_typing_sh... | [((25, 14, 28, 1), 'collections.namedtuple', 'namedtuple', ({(26, 4, 26, 17): '"""OrderValues"""', (27, 4, 27, 87): "('consumer', 'amount', 'serviceId', 'startedAt', 'marketFeeCollector',\n 'marketFee')"}, {}), "('OrderValues', ('consumer', 'amount', 'serviceId', 'startedAt',\n 'marketFeeCollector', 'marketFee'))... |
chrlen/cgmodsel | cgmodsel/prox.py | 1d7336e173289468d55897b1aa044bf98c3c1a6b | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
@author: Frank Nussbaum (frank.nussbaum@uni-jena.de), 2019
"""
import numpy as np
#import scipy
#import abc
#import time
from scipy.optimize import approx_fprime
from scipy.linalg import eigh
from scipy import optimize
from cgmodsel.utils import _logsumexp_condprob... | [((132, 14, 142, 50), 'scipy.optimize.minimize', 'optimize.minimize', (), '', False, 'from scipy import optimize\n'), ((168, 16, 168, 30), 'numpy.triu', 'np.triu', ({(168, 24, 168, 29): 'mat_q'}, {}), '(mat_q)', True, 'import numpy as np\n'), ((195, 15, 195, 38), 'numpy.zeros', 'np.zeros', ({(195, 24, 195, 37): 'self.n... |
MrShoks/OpenMDAO-Framework | openmdao.main/src/openmdao/main/linearsolver.py | 412f34ffe31a95631fbe55ca7d75b84669ae8f8c | """ Linear solvers that are used to solve for the gradient of an OpenMDAO System.
(Not to be confused with the OpenMDAO Solver classes.)
"""
# pylint: disable=E0611, F0401
import numpy as np
from scipy.sparse.linalg import gmres, LinearOperator
from openmdao.main.mpiwrap import MPI
from openmdao.util.graph import fix... | [((55, 25, 55, 45), 'numpy.zeros', 'np.zeros', ({(55, 34, 55, 44): '(n_edge,)'}, {}), '((n_edge,))', True, 'import numpy as np\n'), ((56, 25, 56, 45), 'numpy.zeros', 'np.zeros', ({(56, 34, 56, 44): '(n_edge,)'}, {}), '((n_edge,))', True, 'import numpy as np\n'), ((57, 17, 59, 44), 'scipy.sparse.linalg.LinearOperator', ... |
VivianaEloisa/Viviana_first_repo | Temperatures.py | d132ffdcda8e2c3cd5673cfa86fecc1337697fd0 | def fahr_to_cels(a):
return (a-32)/1.8
def cels_to_fahr(b):
return(b*1.8)+32
c=50
d=10
print("{0} °F is {1}°C.".format(c,fahr_to_cels(c)))
print("{0}°C is {1}°F.".format(d,cels_to_fahr(d)))
| [] |
Andres-CS/wallet-analysis | src/transform.py | 822b8b900a91ab7a2fd76743f174d320e45e98c9 | import csv
import re
'''
Delete char in substring of original string.
Used this function when, you want to delete
a character in a substring but not in the
rest of the original string.
Returns a string
-- PARAMETERS --
text: original string
start: start of subString
end: end of subString
char: char to delete,... | [((93, 8, 93, 47), 're.sub', 're.sub', ({(93, 15, 93, 35): '"""[0-9]{2}\\\\/[0-9]{2}"""', (93, 37, 93, 40): '""","""', (93, 42, 93, 46): 'data'}, {}), "('[0-9]{2}\\\\/[0-9]{2}', ',', data)", False, 'import re\n'), ((118, 8, 118, 33), 're.sub', 're.sub', ({(118, 15, 118, 24): '"""#[0-9]+"""', (118, 25, 118, 27): '""""""... |
fisher60/pyweek-2021 | game/views/credits_view.py | 294b45d768a7e0d85ac67dc4b12384e68fc4f399 | import arcade
from .menu_view import MenuView
TEXT_COLOR = arcade.csscolor.WHITE
class CreditsView(MenuView):
def __init__(self, parent_view):
super().__init__()
self.parent_view = parent_view
def on_draw(self):
arcade.start_render()
arcade.draw_text(
"Credits",... | [((14, 8, 14, 29), 'arcade.start_render', 'arcade.start_render', ({}, {}), '()', False, 'import arcade\n'), ((16, 8, 23, 9), 'arcade.draw_text', 'arcade.draw_text', (), '', False, 'import arcade\n')] |
jgdwyer/nn-convection | sknn_jgd/backend/lasagne/mlp.py | 0bb55c0ac7af8f1345bf17b4db31b2593c8d1b28 | # -*- coding: utf-8 -*-
from __future__ import (absolute_import, division, unicode_literals, print_function)
__all__ = ['MultiLayerPerceptronBackend']
import os
import sys
import math
import time
import types
import logging
import itertools
log = logging.getLogger('sknn')
import numpy
import theano
import sklearn.... | [((14, 6, 14, 31), 'logging.getLogger', 'logging.getLogger', ({(14, 24, 14, 30): '"""sknn"""'}, {}), "('sknn')", False, 'import logging\n'), ((95, 18, 98, 61), 'theano.function', 'theano.function', (), '', False, 'import theano\n'), ((101, 20, 102, 62), 'theano.function', 'theano.function', (), '', False, 'import thean... |
IkramKhan-DevOps/pw-elearn | src/portals/admins/filters.py | 41ac0c9a3dcc6141a25c2618a82bb2673e7f8986 | import django_filters
from django.forms import TextInput
from src.accounts.models import User
from src.application.models import Quiz, StudentGrade
class UserFilter(django_filters.FilterSet):
username = django_filters.CharFilter(widget=TextInput(attrs={'placeholder': 'username'}), lookup_expr='icontains')
fi... | [((9, 48, 9, 92), 'django.forms.TextInput', 'TextInput', (), '', False, 'from django.forms import TextInput\n'), ((10, 50, 10, 96), 'django.forms.TextInput', 'TextInput', (), '', False, 'from django.forms import TextInput\n'), ((11, 49, 11, 94), 'django.forms.TextInput', 'TextInput', (), '', False, 'from django.forms i... |
Vladislav-Zolotaryov/L2J_Levelless_Custom | L2J_DataPack/data/scripts/quests/998_FallenAngelSelect/__init__.py | fb9fd3d22209679258cddc60cec104d740f13b8c | # Made by Kerberos
# this script is part of the Official L2J Datapack Project.
# Visit http://www.l2jdp.com/forum/ for more details.
import sys
from com.l2jserver.gameserver.instancemanager import QuestManager
from com.l2jserver.gameserver.model.quest import State
from com.l2jserver.gameserver.model.quest import QuestS... | [((16, 38, 16, 73), 'com.l2jserver.gameserver.model.quest.jython.QuestJython.__init__', 'JQuest.__init__', ({(16, 54, 16, 58): 'self', (16, 59, 16, 61): 'id', (16, 62, 16, 66): 'name', (16, 67, 16, 72): 'descr'}, {}), '(self, id, name, descr)', True, 'from com.l2jserver.gameserver.model.quest.jython import QuestJython ... |
alehander42/pseudo-python | examples/in.py | 5cdc9211a5ad28e720882f034651d579b0aa0592 | s = [4, 2]
if '2' in s:
print(s)
| [] |
AicyDC/ai-safety-gridworlds | ai_safety_gridworlds/environments/side_effects_sokoban.py | b574b3e42880e32245a6c69502af3e9782ae2879 | # Copyright 2018 The AI Safety Gridworlds 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 b... | [((53, 2, 53, 63), 'absl.flags.DEFINE_integer', 'flags.DEFINE_integer', ({(53, 23, 53, 30): '"""level"""', (53, 32, 53, 33): '(0)', (53, 35, 53, 62): '"""Which game level to play."""'}, {}), "('level', 0, 'Which game level to play.')", False, 'from absl import flags\n'), ((54, 2, 55, 71), 'absl.flags.DEFINE_boolean', '... |
mirca/deepdow | setup.py | 48484f99aa36863b15fb1ae685659841ce37fe25 | from setuptools import find_packages, setup
import deepdow
DESCRIPTION = "Portfolio optimization with deep learning"
LONG_DESCRIPTION = DESCRIPTION
INSTALL_REQUIRES = [
"cvxpylayers",
"matplotlib",
"mlflow",
"numpy>=1.16.5",
"pandas",
"pillow",
"seaborn",
"torch>=1.5",
"tensorboar... | [((29, 13, 29, 45), 'setuptools.find_packages', 'find_packages', (), '', False, 'from setuptools import find_packages, setup\n')] |
chychen/nba_scrip_generation | src/ref/WGAN_CNN_CNN_DISCRETE/Critic.py | 942df59cc0426aa30b54a0e09c0f646aa8fd4f18 | """
modeling
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import os
import time
import shutil
import numpy as np
import tensorflow as tf
from tensorflow.contrib import rnn
from tensorflow.contrib import layers
from utils_cnn import Norm
class C_MODE... | [((39, 22, 39, 28), 'utils_cnn.Norm', 'Norm', ({}, {}), '()', False, 'from utils_cnn import Norm\n'), ((52, 30, 52, 77), 'tensorflow.train.get_or_create_global_step', 'tf.train.get_or_create_global_step', (), '', True, 'import tensorflow as tf\n'), ((55, 27, 56, 121), 'tensorflow.placeholder', 'tf.placeholder', (), '',... |
trsvchn/captum | tests/attr/test_kernel_shap.py | 0435ff10a71724a788bdc54f01324f4f5c788541 | #!/usr/bin/env python3
import io
import unittest
import unittest.mock
from typing import Any, Callable, List, Tuple, Union
import torch
from captum._utils.typing import BaselineType, TensorOrTupleOfTensorsGeneric
from captum.attr._core.kernel_shap import KernelShap
from tests.helpers.basic import (
BaseTest,
... | [((71, 5, 71, 64), 'unittest.mock.patch', 'unittest.mock.patch', (), '', False, 'import unittest\n'), ((377, 4, 377, 19), 'unittest.main', 'unittest.main', ({}, {}), '()', False, 'import unittest\n'), ((35, 14, 35, 37), 'tests.helpers.basic_models.BasicModel_MultiLayer', 'BasicModel_MultiLayer', ({}, {}), '()', False, ... |
volCommunity/vol-crawlers | vol/items.py | d046a23a1a778ed1c1ed483bd565ecb6a23898e5 | # -*- coding: utf-8 -*-
# Define here the models for your scraped items
#
# See documentation in:
# http://doc.scrapy.org/en/latest/topics/items.html
import scrapy
class JobItem(scrapy.Item):
title = scrapy.Field()
url = scrapy.Field()
text = scrapy.Field()
labels = scrapy.Field()
city = scrapy.... | [((12, 12, 12, 26), 'scrapy.Field', 'scrapy.Field', ({}, {}), '()', False, 'import scrapy\n'), ((13, 10, 13, 24), 'scrapy.Field', 'scrapy.Field', ({}, {}), '()', False, 'import scrapy\n'), ((14, 11, 14, 25), 'scrapy.Field', 'scrapy.Field', ({}, {}), '()', False, 'import scrapy\n'), ((15, 13, 15, 27), 'scrapy.Field', 's... |
RamonvdW/nhb-apps | Beheer/tests.py | 5a9f840bfe066cd964174515c06b806a7b170c69 | # -*- coding: utf-8 -*-
# Copyright (c) 2020-2021 Ramon van der Winkel.
# All rights reserved.
# Licensed under BSD-3-Clause-Clear. See LICENSE file for details.
from django.conf import settings
from django.test import TestCase
from django.urls import reverse
from TestHelpers.e2ehelpers import E2EHelpers
# updat... | [((81, 14, 81, 36), 'django.urls.reverse', 'reverse', ({(81, 22, 81, 35): '"""admin:login"""'}, {}), "('admin:login')", False, 'from django.urls import reverse\n'), ((126, 14, 126, 37), 'django.urls.reverse', 'reverse', ({(126, 22, 126, 36): '"""admin:logout"""'}, {}), "('admin:logout')", False, 'from django.urls impor... |
Jingyan95/cmssw | L1Trigger/TrackFindingTracklet/python/ProducerKF_cff.py | f78d843f0837f269ee6811b0e0f4c0432928c190 | import FWCore.ParameterSet.Config as cms
from L1Trigger.TrackTrigger.ProducerSetup_cff import TrackTriggerSetup
from L1Trigger.TrackerTFP.Producer_cfi import TrackerTFPProducer_params
from L1Trigger.TrackerTFP.ProducerES_cff import TrackTriggerDataFormats
from L1Trigger.TrackerTFP.ProducerLayerEncoding_cff import Trac... | [((11, 35, 11, 114), 'FWCore.ParameterSet.Config.EDProducer', 'cms.EDProducer', ({(11, 51, 11, 73): '"""trklet::ProducerKFin"""', (11, 75, 11, 112): 'TrackFindingTrackletProducerKF_params'}, {}), "('trklet::ProducerKFin', TrackFindingTrackletProducerKF_params)", True, 'import FWCore.ParameterSet.Config as cms\n'), ((12... |
ne-msft/py_cui | py_cui/__init__.py | b4938dd2c23a422496af7e32a33c2dbfcb348719 | """A python library for intuitively creating CUI/TUI interfaces with pre-built widgets.
"""
#
# Author: Jakub Wlodek
# Created: 12-Aug-2019
# Docs: https://jwlodek.github.io/py_cui-docs
# License: BSD-3-Clause (New/Revised)
#
# Some python core library imports
import sys
import os
import time
import copy
impo... | [((120, 8, 120, 47), 'os.environ.setdefault', 'os.environ.setdefault', ({(120, 30, 120, 40): '"""ESCDELAY"""', (120, 42, 120, 46): '"""25"""'}, {}), "('ESCDELAY', '25')", False, 'import os\n'), ((141, 25, 141, 80), 'py_cui.statusbar.StatusBar', 'py_cui.statusbar.StatusBar', ({(141, 52, 141, 63): 'self._title', (141, 65... |
mohitjain97/isilon_sdk_python | isi_sdk_8_0/isi_sdk_8_0/models/auth_access_access_item_file.py | a371f438f542568edb8cda35e929e6b300b1177c | # coding: utf-8
"""
Isilon SDK
Isilon SDK - Language bindings for the OneFS API # noqa: E501
OpenAPI spec version: 3
Contact: sdk@isilon.com
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
import pprint
import re # noqa: F401
import six
class AuthAccessAccessItemFile(o... | [((161, 23, 161, 56), 'six.iteritems', 'six.iteritems', ({(161, 37, 161, 55): 'self.swagger_types'}, {}), '(self.swagger_types)', False, 'import six\n')] |
iamthinkking/COMP4217_FinalProject | dataconnector.py | 98cadb013bab52677bffb951b6d173caf4bb22b3 | #!/usr/bin/python3
import pymysql
class Connection:
SQL_HOST = 'localhost'
SQL_USR = ''
SQL_PWD = ''
SQL_DB = 'HOSPITAL'
# initialize database object
def __init__(self, usr, pwd):
self.USR = usr
self.PWD = pwd
# return an database connection
def __ente... | [((20, 19, 20, 96), 'pymysql.connect', 'pymysql.connect', (), '', False, 'import pymysql\n')] |
AHammoudeh/Flow_AH | flow/visualize/plot_custom_callables.py | 16c5641be3e9e85511756f75efd002478edaee9b | """Generate charts from with .npy files containing custom callables through replay."""
import argparse
from datetime import datetime
import errno
import numpy as np
import matplotlib.pyplot as plt
import os
import pytz
import sys
def make_bar_plot(vals, title):
print(len(vals))
fig = plt.figure()
plt.hist... | [((14, 10, 14, 22), 'matplotlib.pyplot.figure', 'plt.figure', ({}, {}), '()', True, 'import matplotlib.pyplot as plt\n'), ((15, 4, 15, 51), 'matplotlib.pyplot.hist', 'plt.hist', (), '', True, 'import matplotlib.pyplot as plt\n'), ((16, 4, 16, 20), 'matplotlib.pyplot.title', 'plt.title', ({(16, 14, 16, 19): 'title'}, {}... |
yugabyte/docsearch-scraper | deployer/src/config_manager.py | 8b58d364c7721cbce892843e946834a3ccc5fcd7 | import algoliasearch
from os import environ
from . import algolia_helper
from . import snippeter
from . import emails
from . import helpers
from . import fetchers
from .helpdesk_helper import add_note, get_conversation, \
get_emails_from_conversation, get_conversation_url_from_cuid
from deployer.src.algolia_inte... | [((37, 30, 37, 65), 'os.environ.get', 'environ.get', ({(37, 42, 37, 64): '"""PUBLIC_CONFIG_FOLDER"""'}, {}), "('PUBLIC_CONFIG_FOLDER')", False, 'from os import environ\n'), ((38, 31, 38, 67), 'os.environ.get', 'environ.get', ({(38, 43, 38, 66): '"""PRIVATE_CONFIG_FOLDER"""'}, {}), "('PRIVATE_CONFIG_FOLDER')", False, 'f... |
pylover/budgie | Source/budgie/__init__.py | f453cf2fbbf440e8e2314c7fb63f101dbe048e17 |
import sys
from sqlalchemy.exc import DatabaseError
from . import cli
from .configuration import settings, init as init_config
from .observer import HelpdeskObserver, MaximumClientsReached
from .models import init as init_models, metadata, engine, check_db
from .smtp import SMTPConfigurationError
__version__ = '0.... | [((44, 8, 44, 19), 'sys.exit', 'sys.exit', ({(44, 17, 44, 18): '(0)'}, {}), '(0)', False, 'import sys\n'), ((27, 8, 27, 20), 'sys.exit', 'sys.exit', ({(27, 17, 27, 19): '(-1)'}, {}), '(-1)', False, 'import sys\n'), ((37, 8, 37, 20), 'sys.exit', 'sys.exit', ({(37, 17, 37, 19): '(-1)'}, {}), '(-1)', False, 'import sys\n'... |
thismakessand/alltheplaces | locations/spiders/shopnsave.py | b6116199844c9e88bff3a691290f07a7457470ba | # -*- coding: utf-8 -*-
import scrapy
import re
from locations.items import GeojsonPointItem
DAY_DICT = {
'Mon': 'Mo',
'Tue': 'Tu',
'Wed': 'We',
'Thu': 'Th',
'Fri': 'Fr',
'Sat': 'Sa',
'Sun': 'Su',
'Monday': 'Mo',
'Tuesday': 'Tu',
'Wednesday': 'We',
'Thursday': 'Th',
'Th... | [((88, 12, 88, 56), 're.search', 're.search', ({(88, 22, 88, 42): '"""([0-9]{1,2})(\\\\spm)"""', (88, 44, 88, 55): 'store_hours'}, {}), "('([0-9]{1,2})(\\\\spm)', store_hours)", False, 'import re\n'), ((55, 18, 55, 48), 'locations.items.GeojsonPointItem', 'GeojsonPointItem', ({}, {}), '(**properties)', False, 'from loc... |
TovarischSuhov/QR_quest | run.py | d2735a60f9018e59fcef09fd76b40c3a1e9d7412 | #!/usr/bin/env python
from app import app
app.run(debug = True)
| [((4, 0, 4, 21), 'app.app.run', 'app.run', (), '', False, 'from app import app\n')] |
DEV3L/twitter-learning-journal | tests/twitter_learning_journal/dao/test_os_env.py | a51d22a60a3d1249add352d8357975a7f2db585c | from unittest.mock import patch
from app.twitter_learning_journal.dao.os_env import os_environ
@patch('app.twitter_learning_journal.dao.os_env.os')
def test_os_environ(mock_os):
expected_value = 'environment_value'
mock_os.environ.__contains__.return_value = True # patch in statement
mock_os.environ.__... | [((6, 1, 6, 52), 'unittest.mock.patch', 'patch', ({(6, 7, 6, 51): '"""app.twitter_learning_journal.dao.os_env.os"""'}, {}), "('app.twitter_learning_journal.dao.os_env.os')", False, 'from unittest.mock import patch\n'), ((13, 18, 13, 37), 'app.twitter_learning_journal.dao.os_env.os_environ', 'os_environ', ({(13, 29, 13,... |
naveenr414/hack-umbc | web-scraper/mongoscraper/populate.py | f5d0fa5b6c3203d54a3c98b8a43b8028229431f8 | import pymongo
myclient = pymongo.MongoClient()
mydb = myclient["mydb"]
hor = mydb["HoR"]
sen = mydb["Senator"]
gov = mydb["Governor"]
def write(fileJSON):
myDoc = fileJSON
if( "hor" in myDoc.values()):
hor.insert_one(myDoc)
elif( "senate" in myDoc.values()):
sen.insert_one(myDoc)
else... | [((3, 11, 3, 32), 'pymongo.MongoClient', 'pymongo.MongoClient', ({}, {}), '()', False, 'import pymongo\n')] |
ZSD-tim/dayu_widgets | tests/test_utils_obj_value.py | 31c2530bdc4161d9311574d9850c2e9471e53072 | """
Test get_obj_value set_obj_value has_obj_value
"""
import pytest
from dayu_widgets import utils
class _HasNameAgeObject(object):
def __init__(self, name, age):
super(_HasNameAgeObject, self).__init__()
self.name = name
self.age = age
@pytest.mark.parametrize('obj', (
{'name': 'xi... | [((22, 5, 26, 6), 'pytest.mark.parametrize', 'pytest.mark.parametrize', ({(22, 29, 22, 52): '"""attr, default, result"""', (22, 54, 26, 5): "(('name', 'hhh', 'xiaoming'), ('age', 0, 18), ('score', 0, 0))"}, {}), "('attr, default, result', (('name', 'hhh',\n 'xiaoming'), ('age', 0, 18), ('score', 0, 0)))", False, 'im... |
kokosing/hue | desktop/core/ext-py/PyYAML-3.12/tests/lib3/test_all.py | 2307f5379a35aae9be871e836432e6f45138b3d9 |
import sys, yaml, test_appliance
def main(args=None):
collections = []
import test_yaml
collections.append(test_yaml)
if yaml.__with_libyaml__:
import test_yaml_ext
collections.append(test_yaml_ext)
return test_appliance.run(collections, args)
if __name__ == '__main__':
main()... | [((11, 11, 11, 48), 'test_appliance.run', 'test_appliance.run', ({(11, 30, 11, 41): 'collections', (11, 43, 11, 47): 'args'}, {}), '(collections, args)', False, 'import sys, yaml, test_appliance\n')] |
Tim-orius/aidem | tim_camera/oop_detection_webcam.py | 965a71888db72f42223777e890f4bcf88cde7fd3 | """ Webcam Detection with Tensorflow calssifier and object distance calculation """
__version__ = "0.1.0"
__author__ = "Tim Rosenkranz"
__email__ = "tim.rosenkranz@stud.uni-frankfurt.de"
__credits__ = "Special thanks to The Anh Vuong who came up with the original idea." \
"This code is also based off of ... | [((46, 22, 46, 41), 'cv2.VideoCapture', 'cv2.VideoCapture', ({(46, 39, 46, 40): '0'}, {}), '(0)', False, 'import cv2\n'), ((129, 19, 129, 30), 'os.getcwd', 'os.getcwd', ({}, {}), '()', False, 'import os\n'), ((132, 23, 132, 67), 'os.path.join', 'os.path.join', ({(132, 36, 132, 44): 'CWD_PATH', (132, 45, 132, 55): 'MODE... |
yakumo-saki/smart_to_zabbix | modules/zabbix_smart.py | 04dd1debe0c831b4ec94962884543c989ad57730 | import json
import logging
import config as cfg
from modules.const import Keys, AttrKey
from modules.zabbix_sender import send_to_zabbix
logger = logging.getLogger(__name__)
SMART_ATTR_KEY = "ata_smart_attributes"
NVME_ATTR_KEY = "nvme_smart_health_information_log"
def send_attribute_discovery(result):
"""
zab... | [((9, 9, 9, 36), 'logging.getLogger', 'logging.getLogger', ({(9, 27, 9, 35): '__name__'}, {}), '(__name__)', False, 'import logging\n'), ((34, 13, 34, 51), 'json.dumps', 'json.dumps', ({(34, 24, 34, 50): "{'data': discovery_result}"}, {}), "({'data': discovery_result})", False, 'import json\n'), ((38, 2, 38, 22), 'modu... |
kpister/biaxial-rnn-music-composition | data.py | f6feafad0fe1066dd957293803a86d6c584d9952 | import itertools
from midi_to_statematrix import UPPER_BOUND, LOWER_BOUND
def startSentinel():
def noteSentinel(note):
position = note
part_position = [position]
pitchclass = (note + LOWER_BOUND) % 12
part_pitchclass = [int(i == pitchclass) for i in range(12)]
return part... | [] |
eocdb/ocdb-server | ocdb/ws/controllers/datasets.py | 0e28d092e8ecf5f4813878aab43de990cc5fb4ee | # The MIT License (MIT)
# Copyright (c) 2018 by EUMETSAT
#
# 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,... | [] |
ayanezcasal/AntLibAYC | libAnt/node.py | c266af973f4c32d4baf30130fe51a572478488ec | import threading
from queue import Queue, Empty
from time import sleep
from libAnt.drivers.driver import Driver
from libAnt.message import *
class Network:
def __init__(self, key: bytes = b'\x00' * 8, name: str = None):
self.key = key
self.name = name
self.number = 0
def __str__(self... | [((22, 24, 22, 41), 'threading.Event', 'threading.Event', ({}, {}), '()', False, 'import threading\n'), ((85, 20, 85, 27), 'queue.Queue', 'Queue', ({}, {}), '()', False, 'from queue import Queue, Empty\n'), ((88, 31, 88, 38), 'queue.Queue', 'Queue', ({}, {}), '()', False, 'from queue import Queue, Empty\n'), ((78, 12, ... |
OliPerkins1987/Wildfire_Human_Agency_Model | tests/test_seasonality.py | 49ac17c7c2ad5e03d572b6ae22c227e89a944624 | # -*- coding: utf-8 -*-
"""
Created on Thu Sep 30 12:17:04 2021
@author: Oli
"""
import pytest
import pandas as pd
import numpy as np
import netCDF4 as nc
import os
from copy import deepcopy
os.chdir(os.path.dirname(os.path.realpath(__file__)))
wd = os.getcwd().replace('\\', '/')
exec(open("test_set... | [((19, 0, 19, 41), 'os.chdir', 'os.chdir', ({(19, 10, 19, 39): "(wd[0:-6] + '/src/data_import')"}, {}), "(wd[0:-6] + '/src/data_import')", False, 'import os\n'), ((82, 6, 82, 22), 'model_interface.wham.WHAM', 'WHAM', ({(82, 11, 82, 21): 'parameters'}, {}), '(parameters)', False, 'from model_interface.wham import WHAM\n... |
unizar-30226-2019-08/Backend | bookalo/funciones_report.py | d14e6fce293330611cd697af033823aa01a2ebfe | from django.shortcuts import render, redirect
from bookalo.pyrebase_settings import db, auth
from bookalo.models import *
from bookalo.serializers import *
#from bookalo.functions import *
from rest_framework import status, permissions
from rest_framework.decorators import api_view, permission_classes
from rest_... | [((41, 10, 42, 16), 'django.core.mail.EmailMessage', 'EmailMessage', (), '', False, 'from django.core.mail import EmailMessage\n')] |
patvdleer/nefit-client-python | tests/test_client.py | 97f2c1e454b7c0d5829e1a9c285c998980c603e3 | import os
import unittest
from nefit import NefitClient, NefitResponseException
class ClientTest(unittest.TestCase):
def test_exceptions(self):
client = NefitClient(
os.environ.get("NEFIT_SERIAL", 123456789),
os.environ.get("NEFIT_ACCESS_KEY", "abc1abc2abc3abc4"),
"asdd... | [((21, 4, 21, 19), 'unittest.main', 'unittest.main', ({}, {}), '()', False, 'import unittest\n'), ((9, 12, 9, 53), 'os.environ.get', 'os.environ.get', ({(9, 27, 9, 41): '"""NEFIT_SERIAL"""', (9, 43, 9, 52): '123456789'}, {}), "('NEFIT_SERIAL', 123456789)", False, 'import os\n'), ((10, 12, 10, 66), 'os.environ.get', 'os... |
GovHawkDC/python-opencivicdata | opencivicdata/merge.py | 1679a4e5df381c777c3e6c53d7c056321662e99a | import datetime
from django.db import transaction
def compute_diff(obj1, obj2):
"""
Given two objects compute a list of differences.
Each diff dict has the following keys:
field - name of the field
new - the new value for the field
one - value of the field in o... | [((83, 30, 83, 56), 'datetime.datetime.utcnow', 'datetime.datetime.utcnow', ({}, {}), '()', False, 'import datetime\n')] |
silverguo/pants | src/python/pants/core/project_info/filedeps.py | 141510d03fbf2b7e1a0b54f66b54088697f6fa51 | # Copyright 2018 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
import itertools
from pathlib import PurePath
from typing import Iterable
from pants.base.build_root import BuildRoot
from pants.engine.addresses import Address, Addresses, BuildFileAddre... | [((87, 12, 89, 13), 'itertools.chain.from_iterable', 'itertools.chain.from_iterable', ({(87, 41, 89, 13): '(hydrated_sources.snapshot.files for hydrated_sources in all_hydrated_sources)'}, {}), '(hydrated_sources.snapshot.files for\n hydrated_sources in all_hydrated_sources)', False, 'import itertools\n'), ((95, 16,... |
dq922/CloudControlVM | perfkitbenchmarker/providers/rackspace/rackspace_network.py | fae2cf7d2c4388e1dc657bd9245d88f2cb1b9b52 | # Copyright 2014 PerfKitBenchmarker 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 appli... | [((41, 21, 41, 37), 'threading.Lock', 'threading.Lock', ({}, {}), '()', False, 'import threading\n'), ((68, 12, 68, 73), 'perfkitbenchmarker.vm_util.IssueRetryableCommand', 'vm_util.IssueRetryableCommand', (), '', False, 'from perfkitbenchmarker import vm_util\n'), ((95, 12, 95, 69), 'perfkitbenchmarker.vm_util.IssueRe... |
mjdesrosiers/dota2py | dota2py/proto/dota_usermessages_pb2.py | 744f44ba6993c99932037df15de2c08dbd265674 | # Generated by the protocol buffer compiler. DO NOT EDIT!
from google.protobuf import descriptor
from google.protobuf import message
from google.protobuf import reflection
from google.protobuf import descriptor_pb2
# @@protoc_insertion_point(imports)
import google.protobuf.descriptor_pb2
import netmessages_pb2
impo... | [((15, 13, 18, 18615), 'google.protobuf.descriptor.FileDescriptor', 'descriptor.FileDescriptor', (), '', False, 'from google.protobuf import descriptor\n'), ((1091, 35, 1109, 1), 'google.protobuf.descriptor.Descriptor', 'descriptor.Descriptor', (), '', False, 'from google.protobuf import descriptor\n'), ((2490, 53, 250... |
rubelw/auth0_client | auth0_client/menu/datafiles/scripts/get_active_user_count.py | 51e68239babcf7c40e40491d1aaa3f8547a67f63 | #!/usr/bin/env python
import json
from auth0_client.Auth0Client import Auth0Client
from auth0_client.menu.menu_helper.common import *
from auth0_client.menu.menu_helper.pretty import *
try:
users = {}
client = Auth0Client(auth_config())
results = client.active_users()
print(pretty(results))
except... | [] |
dark-codr/encryptfinance | encryptfinance/transactions/admin.py | 573a8179c3a7c4b0f68d71bc9d461246f6fdba29 | from __future__ import absolute_import
from django.contrib import admin
from .models import Deposit, Withdrawal, Support
from .forms import DepositForm, WithdrawalForm
# Register your models here.
@admin.register(Deposit)
class DepositAdmin(admin.ModelAdmin):
# form = DepositForm
list_display = ["__str__", "... | [((9, 1, 9, 24), 'django.contrib.admin.register', 'admin.register', ({(9, 16, 9, 23): 'Deposit'}, {}), '(Deposit)', False, 'from django.contrib import admin\n'), ((18, 1, 18, 27), 'django.contrib.admin.register', 'admin.register', ({(18, 16, 18, 26): 'Withdrawal'}, {}), '(Withdrawal)', False, 'from django.contrib impor... |
jlin/inventory | vendor-local/src/django-piston/tests/test_project/settings.py | c098c98e570c3bf9fadfd811eb75e1213f6ea428 | import os
DEBUG = True
DATABASES = {
'default':
{
'ENGINE': 'django.db.backends.sqlite3',
'NAME': '/tmp/piston.db'
}
}
DATABASE_ENGINE = 'sqlite3'
DATABASE_NAME = '/tmp/piston.db'
INSTALLED_APPS = (
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessi... | [((22, 17, 22, 42), 'os.path.dirname', 'os.path.dirname', ({(22, 33, 22, 41): '__file__'}, {}), '(__file__)', False, 'import os\n')] |
UCD4IDS/sage | src/sage/combinat/combinatorial_map.py | 43474c96d533fd396fe29fe0782d44dc7f5164f7 | """
Combinatorial maps
This module provides a decorator that can be used to add semantic to a
Python method by marking it as implementing a *combinatorial map*,
that is a map between two :class:`enumerated sets <EnumeratedSets>`::
sage: from sage.combinat.combinatorial_map import combinatorial_map
sage: class... | [((274, 15, 274, 43), 'sage.misc.sageinspect.sage_getsourcelines', 'sage_getsourcelines', ({(274, 35, 274, 42): 'self._f'}, {}), '(self._f)', False, 'from sage.misc.sageinspect import sage_getsourcelines\n')] |
xdress/xdress | tests/cppproj/xdressrc.py | eb7f0a02b3edf617d401939ede7f0d713a88917f | import os
from xdress.utils import apiname
package = 'cppproj'
packagedir = 'cppproj'
includes = ['src']
plugins = ('xdress.autoall', 'xdress.pep8names', 'xdress.cythongen',
'xdress.stlwrap', )
extra_types = 'cppproj_extra_types' # non-default value
dtypes = [
('map', 'str', 'int'),
('set', 'in... | [((75, 24, 75, 46), 'os.path.join', 'os.path.join', ({(75, 37, 75, 42): '"""src"""', (75, 44, 75, 45): 'x'}, {}), "('src', x)", False, 'import os\n'), ((86, 4, 86, 56), 'xdress.utils.apiname', 'apiname', (), '', False, 'from xdress.utils import apiname\n'), ((87, 4, 87, 32), 'xdress.utils.apiname', 'apiname', ({(87, 12... |
henryshunt/c-aws | routines/server.py | 6e15bb18c2243f11a129b01298cb31749033f8d4 | import os
import subprocess
import routines.config as config
import routines.helpers as helpers
def get_static_info():
""" Outputs data concerning the computer in the C-AWS station
"""
startup_time = None
data_drive_space = None
camera_drive_space = None
# Get system startup ... | [((21, 7, 21, 20), 'routines.config.load', 'config.load', ({}, {}), '()', True, 'import routines.config as config\n'), ((22, 11, 22, 47), 'os.path.isdir', 'os.path.isdir', ({(22, 25, 22, 46): 'config.data_directory'}, {}), '(config.data_directory)', False, 'import os\n'), ((23, 25, 23, 71), 'routines.helpers.remaining_... |
pasmuss/cmssw | DQM/DTMonitorModule/python/dtChamberEfficiencyHI_cfi.py | 566f40c323beef46134485a45ea53349f59ae534 | import FWCore.ParameterSet.Config as cms
from RecoMuon.TrackingTools.MuonServiceProxy_cff import MuonServiceProxy
dtEfficiencyMonitor = cms.EDAnalyzer("DTChamberEfficiency",
MuonServiceProxy,
debug = cms.untracked.bool(True),
TrackCollection = cms.InputTag("standAloneMuons"),
theMaxChi2 = cms.do... | [((7, 12, 7, 36), 'FWCore.ParameterSet.Config.untracked.bool', 'cms.untracked.bool', ({(7, 31, 7, 35): 'True'}, {}), '(True)', True, 'import FWCore.ParameterSet.Config as cms\n'), ((8, 22, 8, 53), 'FWCore.ParameterSet.Config.InputTag', 'cms.InputTag', ({(8, 35, 8, 52): '"""standAloneMuons"""'}, {}), "('standAloneMuons'... |
peterminh227/reinmav-gym | gym_reinmav/envs/mujoco/__init__.py | 518122b16b86d59f744b3116e6187dafd49a3de4 | from gym_reinmav.envs.mujoco.mujoco_quad import MujocoQuadEnv
from gym_reinmav.envs.mujoco.mujoco_quad_hovering import MujocoQuadHoveringEnv
from gym_reinmav.envs.mujoco.mujoco_quad_quat import MujocoQuadQuaternionEnv | [] |
jasonivey/scripts | test.py | 09f9702e5ce62abbb7699aae16b45b33711fe856 | #!/usr/bin/env python3
# vim:softtabstop=4:ts=4:sw=4:expandtab:tw=120
from ansimarkup import AnsiMarkup, parse
import csv
import datetime
import operator
import os
from pathlib import Path
import re
import sys
import traceback
_VERBOSE = False
user_tags = {
'error' : parse('<bold><red>'),
'nam... | [((21, 5, 21, 31), 'ansimarkup.AnsiMarkup', 'AnsiMarkup', (), '', False, 'from ansimarkup import AnsiMarkup, parse\n'), ((16, 14, 16, 34), 'ansimarkup.parse', 'parse', ({(16, 20, 16, 33): '"""<bold><red>"""'}, {}), "('<bold><red>')", False, 'from ansimarkup import AnsiMarkup, parse\n'), ((17, 14, 17, 35), 'ansimarkup.p... |
nogrady/dynamo | RDyn-master/rdyn/test/rdyn_test.py | 4a94453c810cb6cd0eb976c6db9e379cfb2e1f3b | import unittest
import shutil
from rdyn.alg.RDyn_v2 import RDynV2
class RDynTestCase(unittest.TestCase):
def test_rdyn_simplified(self):
print("1")
rdb = RDynV2(size=500, iterations=100)
rdb.execute(simplified=True)
print("2")
rdb = RDynV2(size=500, iterations=100, max_ev... | [((25, 4, 25, 19), 'unittest.main', 'unittest.main', ({}, {}), '()', False, 'import unittest\n'), ((11, 14, 11, 46), 'rdyn.alg.RDyn_v2.RDynV2', 'RDynV2', (), '', False, 'from rdyn.alg.RDyn_v2 import RDynV2\n'), ((14, 14, 14, 58), 'rdyn.alg.RDyn_v2.RDynV2', 'RDynV2', (), '', False, 'from rdyn.alg.RDyn_v2 import RDynV2\n... |
Jung-Jun-Uk/UNPG | recognition/datasets/build.py | a6f9c1731a68fc035eb8fe8198f5a5c643825a5b | import os
from .kface import KFace
from .ms1m import MS1M
from .bin_datasets import BIN
from .ijb import IJB
def build_datasets(data_cfg, batch_size, cuda, workers, mode, rank=-1):
assert mode in ['train', 'test']
cfg = data_cfg[mode]
if cfg['dataset'] == 'kface':
dataset =... | [((21, 24, 21, 54), 'os.path.join', 'os.path.join', ({(21, 37, 21, 41): 'root', (21, 43, 21, 53): 'file_names'}, {}), '(root, file_names)', False, 'import os\n'), ((24, 25, 24, 46), 'os.path.join', 'os.path.join', ({(24, 38, 24, 42): 'root', (24, 44, 24, 45): 'f'}, {}), '(root, f)', False, 'import os\n')] |
ppinard/django-cd | django_cd/notifications.py | 1bc9304466ace12867df3b18a8ef7f204b9744b4 | """"""
# Standard library modules.
import abc
# Third party modules.
from django.core.mail import send_mail
from django.template import Engine, Context
# Local modules.
from .models import RunState
# Globals and constants variables.
class Notification(metaclass=abc.ABCMeta):
@classmethod
def notify(self, ... | [((35, 21, 35, 41), 'django.template.Engine.get_default', 'Engine.get_default', ({}, {}), '()', False, 'from django.template import Engine, Context\n'), ((37, 22, 37, 49), 'django.template.Context', 'Context', ({(37, 30, 37, 48): "{'jobrun': jobrun}"}, {}), "({'jobrun': jobrun})", False, 'from django.template import En... |
jpazdera/PazdKaha22 | Experiment/ltpFR3_MTurk/ListGen/ltpFR3_listgen.py | 9b3157cbcc68aafc829dbd38f3271f884caf541d | #!/usr/bin/env python2
import random
import itertools
import numpy
import sys
import json
import copy
def make_bins_ltpFR3(semArray):
"""
Creates four equal-width bins of WAS scores, identical to those used in ltpFR2. Then combine the middle two to give
three bins: low similarity, medium similarity, and h... | [] |
DwijayDS/fastestimator | fastestimator/dataset/data/cifar10.py | 9b288cb2bd870f971ec4cee09d0b3205e1316a94 | # Copyright 2019 The FastEstimator 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 appl... | [((35, 43, 35, 80), 'tensorflow.keras.datasets.cifar10.load_data', 'tf.keras.datasets.cifar10.load_data', ({}, {}), '()', True, 'import tensorflow as tf\n'), ((36, 17, 36, 71), 'fastestimator.dataset.numpy_dataset.NumpyDataset', 'NumpyDataset', ({(36, 30, 36, 70): '{image_key: x_train, label_key: y_train}'}, {}), '({im... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.