repo_name stringlengths 7 94 | repo_path stringlengths 4 237 | repo_head_hexsha stringlengths 40 40 | content stringlengths 10 680k | apis stringlengths 2 840k |
|---|---|---|---|---|
J-asy/Emotion-FAN | basic_code/networks.py | 30c1e24a31b2a05c0810a17eb533096a7baaeeef | import torch.nn as nn
import math
import torch.utils.model_zoo as model_zoo
import torch.nn.functional as F
import torch
import numpy as np
import cv2
import pdb
def sigmoid(x):
return 1 / (1 + math.exp(-x))
def norm_angle(angle):
norm_angle = sigmoid(10 * (abs(angle) / 0.7853975 - 1))
return norm_angle
... | [((20, 11, 21, 43), 'torch.nn.Conv2d', 'nn.Conv2d', (), '', True, 'import torch.nn as nn\n'), ((30, 19, 30, 41), 'torch.nn.BatchNorm2d', 'nn.BatchNorm2d', ({(30, 34, 30, 40): 'planes'}, {}), '(planes)', True, 'import torch.nn as nn\n'), ((31, 20, 31, 29), 'torch.nn.ReLU', 'nn.ReLU', ({}, {}), '()', True, 'import torch.... |
symphonyrm/ndscheduler | ndscheduler/server/handlers/index.py | e9a56ef345b25916a2b53d1ea3349efb532d63ce | """Serves the single page app web ui."""
import json
import tornado.gen
from ndscheduler import settings
from ndscheduler import utils
from ndscheduler.server.handlers import base
class Handler(base.BaseHandler):
"""Index page request handler."""
@tornado.gen.coroutine
def get(self):
"""Serve u... | [((18, 20, 18, 50), 'ndscheduler.utils.get_all_available_jobs', 'utils.get_all_available_jobs', ({}, {}), '()', False, 'from ndscheduler import utils\n'), ((19, 60, 19, 81), 'json.dumps', 'json.dumps', ({(19, 71, 19, 80): 'meta_info'}, {}), '(meta_info)', False, 'import json\n')] |
eoc21/biopython | Scripts/xbbtools/xbb_io.py | c0f8db8f55a506837c320459957a0ce99b0618b6 | #!/usr/bin/env python
# Created: Wed Jun 21 13:46:35 2000
# Last changed: Time-stamp: <00/12/02 14:18:23 thomas>
# Thomas.Sicheritz@molbio.uu.se, http://evolution.bmc.uu.se/~thomas
# File: xbb_io.py
import os, sys # os.system, sys.argv
sys.path.insert(0, '.')
sys.path.insert(0, os.path.expanduser('~thomas/cbs/python/... | [] |
kolyasalubov/Lv-677.PythonCore | HW6/Andrii_Haponov/cw_4.py | c9f9107c734a61e398154a90b8a3e249276c2704 | # Convert a Number to a String!
# We need a function that can transform a number into a string.
# What ways of achieving this do you know?
def number_to_string(num: int) -> str:
str_num = str(num)
return str_num
print(number_to_string(123))
print(type(number_to_string(123))) | [] |
explosion/healthsea | project/scripts/clausecat/evaluate_clausecat.py | 4481488ed9fc85b89844ee872d0a8412a33f0b15 | import spacy
from spacy.scorer import PRFScore
import typer
from pathlib import Path
from wasabi import Printer, table
import operator
import benepar
import clausecat_component
import clausecat_model
import clausecat_reader
import clause_segmentation
import clause_aggregation
msg = Printer()
def main(model_path: Pa... | [((15, 6, 15, 15), 'wasabi.Printer', 'Printer', ({}, {}), '()', False, 'from wasabi import Printer, table\n'), ((21, 10, 21, 32), 'spacy.load', 'spacy.load', ({(21, 21, 21, 31): 'model_path'}, {}), '(model_path)', False, 'import spacy\n'), ((22, 13, 22, 56), 'clausecat_reader.ClausecatCorpus', 'clausecat_reader.Clausec... |
david-waugh/network-automation | utils/test.py | c85ab092cd9b76753c4d35f113126cfb663c1933 | import pathlib
print(pathlib.Path(__file__).parent.resolve())
while True:
next_cmd = input("> ")
print(eval(next_cmd))
| [((3, 6, 3, 28), 'pathlib.Path', 'pathlib.Path', ({(3, 19, 3, 27): '__file__'}, {}), '(__file__)', False, 'import pathlib\n')] |
IBM/deepsearch-nlp-annotator-api-example | nlp_annotator_api/server/app.py | 76c2c8fd83c1e6d51c51c7b581a8c3f273b23c40 | import logging
import os
import aiohttp.web
from connexion import AioHttpApp
from nlp_annotator_api.config.config import conf
from nlp_annotator_api.config.logging import setup_logging
from nlp_annotator_api.server.middleware.statsd_middleware import StatsdMiddleware
from nlp_annotator_api.server.signals.statsd_clien... | [((12, 0, 12, 15), 'nlp_annotator_api.config.logging.setup_logging', 'setup_logging', ({}, {}), '()', False, 'from nlp_annotator_api.config.logging import setup_logging\n'), ((14, 13, 14, 58), 'logging.getLogger', 'logging.getLogger', ({(14, 31, 14, 57): '"""nlp_annotator_api.access"""'}, {}), "('nlp_annotator_api.acce... |
dcleres/keras_cv_attention_models | keras_cv_attention_models/resnest/resnest.py | 264876673e369f23eff49b3b589b72f908a9625b | import tensorflow as tf
from tensorflow import keras
from tensorflow.keras import backend as K
from keras_cv_attention_models.aotnet import AotNet
from keras_cv_attention_models.download_and_load import reload_model_weights
from keras_cv_attention_models.attention_layers import batchnorm_with_activation, conv2d_no_bias... | [((42, 13, 42, 96), 'keras_cv_attention_models.attention_layers.batchnorm_with_activation', 'batchnorm_with_activation', (), '', False, 'from keras_cv_attention_models.attention_layers import batchnorm_with_activation, conv2d_no_bias\n'), ((49, 10, 49, 62), 'tensorflow.reduce_mean', 'tf.reduce_mean', (), '', True, 'imp... |
brianherman/data-act-broker-backend | dataactcore/migrations/versions/8692ab1298e1_replace_filerequest_with_filegeneration.py | 80eb055b9d245046192f7ad4fd0be7d0e11d2dec | """replace FileRequest with FileGeneration
Revision ID: 8692ab1298e1
Revises: 4bbc47f2b48d
Create Date: 2018-10-24 14:54:39.278159
"""
# revision identifiers, used by Alembic.
revision = '8692ab1298e1'
down_revision = '4bbc47f2b48d'
branch_labels = None
depends_on = None
from alembic import op
import sqlalchemy as ... | [((53, 4, 53, 158), 'alembic.op.create_foreign_key', 'op.create_foreign_key', (), '', False, 'from alembic import op\n'), ((54, 4, 54, 40), 'alembic.op.drop_column', 'op.drop_column', ({(54, 19, 54, 24): '"""job"""', (54, 26, 54, 39): '"""from_cached"""'}, {}), "('job', 'from_cached')", False, 'from alembic import op\n... |
Birfy/Endlinking | cluster.py | cc87a5528498e1733111d302437aeb1142b0a47f | import numpy as np
import random
import sys
chainlength = int(sys.argv[1])
dfname = sys.argv[2]
outfl = 'result.data'
cluster_size = int(sys.argv[3])
def readsize(dfname):
with open(dfname, 'r') as df:
lines = df.readlines()
for line in lines:
content = line.split()
if content and cont... | [((186, 7, 186, 35), 'numpy.array', 'np.array', ({(186, 16, 186, 34): '[size, size, size]'}, {}), '([size, size, size])', True, 'import numpy as np\n'), ((36, 11, 36, 22), 'numpy.array', 'np.array', ({(36, 20, 36, 21): 'M'}, {}), '(M)', True, 'import numpy as np\n'), ((40, 14, 40, 49), 'numpy.empty', 'np.empty', (), ''... |
isunchy/cuboid_abstraction | util/hierarchical_primitive/cube_inclusion.py | afda6ca8516c2f5e5e7292b3b22a059a4f6c84ec | import numpy as np
import quaternion
sample_points = np.array([[-1.0,-1.0,-1.0,-1.0,-1.0,-1.0,-1.0,-1.0,-1.0,-1.0,-1.0,-1.0,-1.0,-1.0,-1.0,-1.0,-1.0,-1.0,-1.0,-1.0,-1.0,-1.0,-1.0,-1.0,-1.0,-1.0,-1.0,-1.0,-1.0,-1.0,-1.0,-1.0,-1.0,-1.0,-1.0,-1.0,-1.0,-1.0,-1.0,-1.0,-1.0,-1.0,-1.0,-1.0,-1.0,-1.0,-1.0,-1.0,-1.0,-1.0,... | [((5, 16, 8, 46), 'numpy.array', 'np.array', (), '', True, 'import numpy as np\n'), ((9, 16, 9, 43), 'numpy.transpose', 'np.transpose', ({(9, 29, 9, 42): 'sample_points'}, {}), '(sample_points)', True, 'import numpy as np\n'), ((19, 23, 19, 53), 'numpy.zeros', 'np.zeros', ({(19, 32, 19, 52): '[n_cube_1, n_cube_2]'}, {}... |
kayduemre/ituro | ituro/accounts/tests.py | eb5bb0655c2d85eed212d28c1d154006c57a4f03 | from django.test import TestCase
from django.utils import timezone
from accounts.models import CustomUser, CustomUserManager
class UserCreateTestCase(TestCase):
def test_create_user_correctly(self):
"Creating users correctly"
new_user = CustomUser.objects.create(
email="participant@gm... | [((17, 24, 17, 38), 'django.utils.timezone.now', 'timezone.now', ({}, {}), '()', False, 'from django.utils import timezone\n')] |
oleksost/continuum | continuum/datasets/dtd.py | 682d66540bfbfa171ac73281ed2989f9338e88bf | import os
from typing import List
import numpy as np
from torchvision import datasets as torchdata
from continuum.datasets import ImageFolderDataset
from continuum import download
from continuum.tasks import TaskType
class DTD(ImageFolderDataset):
"""Describable Textures Dataset (DTD)
Reference:
* ... | [((30, 23, 30, 72), 'os.path.join', 'os.path.join', ({(30, 36, 30, 50): 'self.data_path', (30, 52, 30, 71): '"""dtd-r1.0.1.tar.gz"""'}, {}), "(self.data_path, 'dtd-r1.0.1.tar.gz')", False, 'import os\n'), ((60, 18, 60, 41), 'numpy.isin', 'np.isin', ({(60, 26, 60, 27): 'x', (60, 29, 60, 40): 'valid_paths'}, {}), '(x, va... |
Doometnick/MaxiMin-2048 | src/tests/testdata.py | f1d795ec07fffe1aa239c105cf522d2c3bc9b011 | from board import Direction
# Tuples of input, action, expected output.
moving_tests = [
(
[[0,0,0,0],
[4,0,0,0],
[0,0,0,0],
[4,0,2,0]],
Direction.UP,
[[8,0,2,0],
[0,0,0,0],
[0,0,0,0],
[0,0,0,0]]
),
(
[[0,0,0,0],
... | [] |
HansBug/pji | test/utils/test_value.py | 449d171cea0c03f4c302da886988f36f70e34ee6 | import pytest
from pji.utils import ValueProxy
@pytest.mark.unittest
class TestUtilsValue:
def test_value_proxy_init(self):
value = ValueProxy()
assert value.value is None
value = ValueProxy(233)
assert value.value == 233
def test_value_proxy_set(self):
value = Value... | [((9, 16, 9, 28), 'pji.utils.ValueProxy', 'ValueProxy', ({}, {}), '()', False, 'from pji.utils import ValueProxy\n'), ((12, 16, 12, 31), 'pji.utils.ValueProxy', 'ValueProxy', ({(12, 27, 12, 30): '233'}, {}), '(233)', False, 'from pji.utils import ValueProxy\n'), ((16, 16, 16, 28), 'pji.utils.ValueProxy', 'ValueProxy', ... |
Ebenazer-2002/library-management | intro.py | 8c1ededc7167d2221a3947abfeec4773da39dca9 | #Intro Page
from tkinter import *
from PIL import Image, ImageTk
import cv2
#----------------------------Start Function--------------------------#
def start(event):
label1.destroy()
import log
win.destroy()
log.main()
#------------------------Main Window---------------------------------#li
def main_... | [((12, 4, 12, 14), 'log.main', 'log.main', ({}, {}), '()', False, 'import log\n'), ((26, 10, 26, 44), 'cv2.VideoCapture', 'cv2.VideoCapture', ({(26, 27, 26, 43): '"""images/vid.MP4"""'}, {}), "('images/vid.MP4')", False, 'import cv2\n'), ((37, 23, 37, 62), 'cv2.cvtColor', 'cv2.cvtColor', ({(37, 36, 37, 41): 'frame', (3... |
hugh9876/04-multivariate-analysis | notebooks/week4_help.py | 0541962842df8844aa323c368f8a4e44999c2d7f | """
This module provides helper functions to support exercises during AM1
with outliers, robust regression and template regression in the CORE
data analytics workshop series, week 4.
"""
import numpy as np
import pandas as pd
import math
from collections import namedtuple
def recovery_sulphur_dataframe_wit... | [((43, 11, 44, 49), 'pandas.DataFrame', 'pd.DataFrame', ({(43, 24, 44, 48): "{'metal_recovery_percent': recovery_percent, 'feed_sulphur_percent':\n sulphur_percent}"}, {}), "({'metal_recovery_percent': recovery_percent,\n 'feed_sulphur_percent': sulphur_percent})", True, 'import pandas as pd\n'), ((48, 11, 48, 38... |
0xOmarA/RadixLib | tests/actions/test_mutable_token_action.py | 85d75a47d4c4df4c1a319b74857ae2c513933623 | from radixlib.actions import CreateTokenDefinition
from typing import Dict, Any
import unittest
class TestMutableTokenAction(unittest.TestCase):
""" Unit tests for the CreateTokenDefinition action of mutable tokens """
ActionDict: Dict[str, Any] = {
"token_properties": {
"name": "MutableTe... | [((34, 42, 34, 90), 'radixlib.actions.CreateTokenDefinition.from_dict', 'CreateTokenDefinition.from_dict', ({(34, 74, 34, 89): 'self.ActionDict'}, {}), '(self.ActionDict)', False, 'from radixlib.actions import CreateTokenDefinition\n'), ((54, 41, 54, 89), 'radixlib.actions.CreateTokenDefinition.from_dict', 'CreateToken... |
Trimatix/carica | src/tests/testModules/loadCfg_typeCasting/allowsCastFailKeeping/primativeTypes.py | 074be16bdf50541eb3ba92ca42d0ad901cc51bd0 | floatVar = 1.0
listVar = [3, "hello"]
dictVar = {
"myField": "value"
}
aotVar = [dictVar, dictVar]
intVar = 1 | [] |
arosen93/HT-ASE | quacc/recipes/xtb/__init__.py | a76542e7a2bc5bf6e7382d8f1387374eb2abc713 | """Recipes for xTB"""
| [] |
StephanErb/pants | src/python/pants/backend/native/subsystems/xcode_cli_tools.py | a368267b6b4cf50138ba567f582409ed31bf5db9 | # coding=utf-8
# Copyright 2018 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from __future__ import absolute_import, division, print_function, unicode_literals
import os
from pants.backend.native.config.environment import Assembler, CCompiler, CppC... | [((173, 18, 173, 39), 'pants.engine.selectors.Select', 'Select', ({(173, 25, 173, 38): 'XCodeCLITools'}, {}), '(XCodeCLITools)', False, 'from pants.engine.selectors import Select\n'), ((178, 15, 178, 36), 'pants.engine.selectors.Select', 'Select', ({(178, 22, 178, 35): 'XCodeCLITools'}, {}), '(XCodeCLITools)', False, '... |
yzhaobom/improver | improver_tests/regrid/test_RegridWithLandSeaMask.py | 47f9e103c63f890bfbb24d5e08d9d01d041514f7 | # -*- coding: utf-8 -*-
# -----------------------------------------------------------------------------
# (C) British Crown Copyright 2017-2021 Met Office.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions a... | [((60, 14, 60, 35), 'numpy.linspace', 'np.linspace', ({(60, 26, 60, 27): '0', (60, 29, 60, 31): '15', (60, 33, 60, 34): '4'}, {}), '(0, 15, 4)', True, 'import numpy as np\n'), ((61, 14, 61, 35), 'numpy.linspace', 'np.linspace', ({(61, 26, 61, 27): '0', (61, 29, 61, 31): '40', (61, 33, 61, 34): '5'}, {}), '(0, 40, 5)', ... |
garnaat/details | setup.py | 07f2fc7f27b29a6ddcda918abf6ae0882450319e | #!/usr/bin/env python
from setuptools import setup, find_packages
import os
requires = [
]
setup(
name='details',
version=open(os.path.join('details', '_version')).read(),
description='Tools for processing AWS detailed billing reports',
long_description=open('README.md').read(),
author='Mitch G... | [((19, 13, 19, 46), 'setuptools.find_packages', 'find_packages', (), '', False, 'from setuptools import setup, find_packages\n'), ((13, 17, 13, 52), 'os.path.join', 'os.path.join', ({(13, 30, 13, 39): '"""details"""', (13, 41, 13, 51): '"""_version"""'}, {}), "('details', '_version')", False, 'import os\n')] |
YannickDieter/beam_telescope_analysis | beam_telescope_analysis/testing/test_kalman.py | 0c678ad991a9ef42178b2eeaf58059d387362f2a | ''' Script to check the correctness of the analysis. The analysis is done on raw data and all results are compared to a recorded analysis.
'''
import os
import unittest
import numpy as np
from beam_telescope_analysis import track_analysis
from beam_telescope_analysis.tools import test_tools
class TestTrackAnalysis... | [((72, 4, 72, 128), 'logging.basicConfig', 'logging.basicConfig', (), '', False, 'import logging\n'), ((30, 21, 30, 128), 'numpy.array', 'np.array', ({(30, 30, 30, 127): '[(18.5, 18.5), (18.5, 18.5), (18.5, 18.5), (18.5, 18.5), (18.5, 18.5), (\n 18.5, 18.5), (250.0, 50.0)]'}, {}), '([(18.5, 18.5), (18.5, 18.5), (18.... |
asnramos/asv | test/test_workflow.py | 8a0979b532d06c7c352826e2acf0dd872922260e | # Licensed under a 3-clause BSD style license - see LICENSE.rst
import glob
import os
import sys
import json
from os.path import join, isfile
import pytest
from asv import util
from . import tools
def test_run_publish(capfd, basic_conf_2):
tmpdir, local, conf, machine_file = basic_conf_2
tmpdir = util.lon... | [((18, 13, 18, 35), 'asv.util.long_path', 'util.long_path', ({(18, 28, 18, 34): 'tmpdir'}, {}), '(tmpdir)', False, 'from asv import util\n'), ((41, 18, 41, 52), 'os.path.join', 'join', ({(41, 23, 41, 29): 'tmpdir', (41, 31, 41, 37): '"""html"""', (41, 39, 41, 51): '"""index.html"""'}, {}), "(tmpdir, 'html', 'index.html... |
Metro1998/P-DQN | trainer.py | 6ab2ac6991d2685f10887c16f854ebba6144b306 | # @author Metro
# @time 2021/11/24
import os.path
import gym
from agents.pdqn import P_DQN
from utilities.memory import ReplayBuffer
from utilities.utilities import *
from utilities.route_generator import generate_routefile
class Train_and_Evaluate(object):
def __init__(self, config):
# Environment
... | [((16, 8, 16, 66), 'utilities.route_generator.generate_routefile', 'generate_routefile', (), '', False, 'from utilities.route_generator import generate_routefile\n'), ((17, 19, 17, 47), 'gym.make', 'gym.make', ({(17, 28, 17, 46): 'config.environment'}, {}), '(config.environment)', False, 'import gym\n'), ((20, 21, 20, ... |
splunk/splunk-webframework | server/splunkdj/views.py | a4179558616f5f4fcbfa2b54e9179f30e6395264 | import sys
import pprint
import json
import datetime
import uuid
import urllib
import types
import traceback
from django.core.urlresolvers import reverse, resolve
from django.http import HttpResponseRedirect, Http404, HttpResponseServerError, HttpResponseNotFound
from django.conf import settings
from django.contrib.aut... | [] |
mmulich/wildbook-ia | wbia/plottool/interact_keypoints.py | 81b405e2bfaa3f6c30a546fb6dc6e6488e9b2663 | # -*- coding: utf-8 -*-
import logging
import utool as ut
import six
from . import draw_func2 as df2
from wbia.plottool import plot_helpers as ph
from wbia.plottool import interact_helpers as ih
from wbia.plottool.viz_featrow import draw_feat_row
from wbia.plottool.viz_keypoints import show_keypoints
from wbia.plottool... | [((12, 24, 12, 44), 'utool.inject2', 'ut.inject2', ({(12, 35, 12, 43): '__name__'}, {}), '(__name__)', True, 'import utool as ut\n'), ((13, 9, 13, 34), 'logging.getLogger', 'logging.getLogger', ({(13, 27, 13, 33): '"""wbia"""'}, {}), "('wbia')", False, 'import logging\n'), ((132, 10, 132, 48), 'wbia.plottool.interact_h... |
DronMDF/manabot | tb/storage/__init__.py | b412e8cb9b5247f05487bed4cbf4967f7b58327f | from .database import StDatabase
from .telegram import StTelegram
from .tinydb import TinyDataBase, TinySelect
from .utility import StDispatch
| [] |
hbqdev/algorithms | algorithms/maths/chinese_remainder_theorem.py | 65cc8551d86d7e065069d165dd8bf9baf10345a0 | from algorithms.maths.gcd import gcd
from typing import List
def solve_chinese_remainder(num : List[int], rem : List[int]):
"""
Computes the smallest x that satisfies the chinese remainder theorem
for a system of equations.
The system of equations has the form:
x % num[0] = rem[0]
x % num[1] = ... | [((44, 15, 44, 30), 'algorithms.maths.gcd.gcd', 'gcd', ({(44, 19, 44, 23): 'l[i]', (44, 25, 44, 29): 'l[j]'}, {}), '(l[i], l[j])', False, 'from algorithms.maths.gcd import gcd\n')] |
Jette16/spacy-course | exercises/ja/exc_03_16_01.py | 32df0c8f6192de6c9daba89740a28c0537e4d6a0 | import spacy
nlp = spacy.load("ja_core_news_sm")
text = (
"チックフィレイはジョージア州カレッジパークに本社を置く、"
"チキンサンドを専門とするアメリカのファストフードレストランチェーンです。"
)
# トークナイズのみ行う
doc = nlp(text)
print([token.text for token in doc])
| [((3, 6, 3, 35), 'spacy.load', 'spacy.load', ({(3, 17, 3, 34): '"""ja_core_news_sm"""'}, {}), "('ja_core_news_sm')", False, 'import spacy\n')] |
caiyueliang/chineseocr | apphelper/image.py | 4495598f938936c6bcb2222fa44f840a7919212c | # -*- coding: utf-8 -*-
"""
##图像相关函数
@author: lywen
"""
import sys
import six
import os
import base64
import requests
import numpy as np
import cv2
from PIL import Image
import traceback
import uuid
from glob import glob
from bs4 import BeautifulSoup
def sort_box_(box):
x1,y1,x2,y2,x3,y3,x4,y4 = box[:8]
pts =... | [((22, 10, 22, 40), 'numpy.array', 'np.array', (), '', True, 'import numpy as np\n'), ((74, 11, 74, 54), 'numpy.array', 'np.array', (), '', True, 'import numpy as np\n'), ((118, 7, 118, 24), 'os.path.exists', 'os.path.exists', ({(118, 22, 118, 23): 'p'}, {}), '(p)', False, 'import os\n'), ((350, 13, 350, 28), 'numpy.ar... |
harveywwu/OpenData | opendatatools/common/ui_util.py | cf421465dd9b11fdbb2fbf4d00512e3aaf09d070 | # -*- coding: UTF-8 -*-
import sys, time
class ShowProcess():
"""
显示处理进度的类
调用该类相关函数即可实现处理进度的显示
"""
i = 0 # 当前的处理进度
max_steps = 0 # 总共需要处理的次数
max_arrow = 50 #进度条的长度
infoDone = 'done'
# 初始化函数,需要知道总共的处理次数
def __init__(self, max_steps, infoDone = 'Done'):
self.max_steps = ... | [] |
JunzhongLin/leetcode_practice | data_structure/stack_and_queue/494. Target Sum_ Medium.py | 47b2f5cc3c87de004ae21a94024e751b40b8f559 | '''
You are given an integer array nums and an integer target.
You want to build an expression out of nums by adding one of the symbols '+' and '-' before each integer in nums and then concatenate all the integers.
For example, if nums = [2, 1], you can add a '+' before 2 and a '-' before 1 and concatenate them to bu... | [((17, 16, 17, 32), 'collections.defaultdict', 'defaultdict', ({(17, 28, 17, 31): 'int'}, {}), '(int)', False, 'from collections import defaultdict\n')] |
os-gabe/fixtrack | fixtrack/frontend/pickable_markers.py | a0af4dfa9342acc0ba05c0249a32806c825b74b2 | import numpy as np
from fixtrack.frontend.pickable_base import PickableBase
from vispy import scene
class PickableMarkers(PickableBase):
"""
Markers that can highlight on hover and be selected
"""
class State(PickableBase.State):
def __init__(self, **kwargs):
super(PickableMarker... | [((26, 41, 26, 57), 'numpy.zeros', 'np.zeros', ({(26, 50, 26, 56): '(0, 3)'}, {}), '((0, 3))', True, 'import numpy as np\n'), ((57, 32, 57, 74), 'numpy.full', 'np.full', ({(57, 40, 57, 45): '(n,)', (57, 47, 57, 73): "self._cfg.vis_args['size']"}, {}), "((n,), self._cfg.vis_args['size'])", True, 'import numpy as np\n'),... |
FFY00/jeepney | examples/blocking_subscribe.py | 293241a54fbb73581755e97191720ed1603aed34 | """
Example of subscribing to a D-Bus signal using blocking I/O.
This subscribes to the signal for a desktop notification being closed.
To try it, start this script, then trigger a desktop notification, and close it
somehow to trigger the signal. Use Ctrl-C to stop the script.
This example relies on the ``org.freedes... | [((21, 7, 23, 61), 'jeepney.wrappers.DBusAddress', 'DBusAddress', (), '', False, 'from jeepney.wrappers import DBusAddress\n'), ((25, 13, 25, 52), 'jeepney.integrate.blocking.connect_and_authenticate', 'connect_and_authenticate', (), '', False, 'from jeepney.integrate.blocking import connect_and_authenticate, Proxy\n')... |
league3236/shholiday | test.py | 54d0fcfd393d09183cd77cab697f5bc60864b314 | from shholiday import holiday2020 as hd
daytuple = (1,1)
nowholiday = hd.holiday2020()
print(nowholiday.is_holiday(daytuple)) | [((4, 13, 4, 29), 'shholiday.holiday2020.holiday2020', 'hd.holiday2020', ({}, {}), '()', True, 'from shholiday import holiday2020 as hd\n')] |
dalejung/pandas-composition | setup.py | e73e5295b2d2f44f09805dcf06db12108c555197 | from distutils.core import setup
DISTNAME='pandas_composition'
FULLVERSION='0.1' ... | [((6, 0, 10, 7), 'distutils.core.setup', 'setup', (), '', False, 'from distutils.core import setup\n')] |
encukou/Zpetnovazebnik | blog/migrations/0005_title_null.py | 0d058fd67049a3d42814b04486bde93bc406fa3b | # Generated by Django 2.1.7 on 2019-02-27 14:23
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('blog', '0004_longer_password'),
]
operations = [
migrations.AlterField(
model_name='session',
name='title',
... | [((16, 18, 16, 73), 'django.db.models.CharField', 'models.CharField', (), '', False, 'from django.db import migrations, models\n')] |
Kuba77/Xian-DB | setup.py | 2f15ef1b9b7a96c21bd46e9fb8481de6feb713b7 | from setuptools import setup
from codecs import open
from os import path
here = path.abspath(path.dirname(__file__))
with open(path.join(here, 'README.rst'), encoding='utf-8') as f:
long_description = f.read()
setup(
name='xiandb',
version='0.2.0',
description='A database model for Xian',
long_d... | [((10, 0, 42, 1), 'setuptools.setup', 'setup', (), '', False, 'from setuptools import setup\n'), ((5, 20, 5, 42), 'os.path.dirname', 'path.dirname', ({(5, 33, 5, 41): '__file__'}, {}), '(__file__)', False, 'from os import path\n'), ((7, 10, 7, 39), 'os.path.join', 'path.join', ({(7, 20, 7, 24): 'here', (7, 26, 7, 38): ... |
ashishpatel26/tf2-yolo3 | yolo3/focal_loss.py | 38814178643eb8e1f8b5e4fe8d448faed44ad574 | from functools import partial
import tensorflow as tf
_EPSILON = tf.keras.backend.epsilon()
def register_keras_custom_object(cls):
tf.keras.utils.get_custom_objects()[cls.__name__] = cls
return cls
def binary_focal_loss(y_true, y_pred, gamma, *, pos_weight=None, from_logits=False, label_smoothing=None):
... | [((4, 11, 4, 37), 'tensorflow.keras.backend.epsilon', 'tf.keras.backend.epsilon', ({}, {}), '()', True, 'import tensorflow as tf\n'), ((13, 13, 13, 41), 'tensorflow.convert_to_tensor', 'tf.convert_to_tensor', ({(13, 34, 13, 40): 'y_pred'}, {}), '(y_pred)', True, 'import tensorflow as tf\n'), ((62, 13, 62, 48), 'tensorf... |
Sult/evetool | characters/models/characters.py | 155db9f3b0ecc273fe3c75daf8f9c6f37cb3e47f | import time
from collections import OrderedDict
from datetime import datetime, timedelta
from django.db import models
from django.conf import settings
from django.utils.timezone import utc
from .skills import Skill, SkillGroup
from metrics.models import Corporation
from tasks.models import EveApiCache, Task
from evet... | [((20, 10, 20, 39), 'django.db.models.ForeignKey', 'models.ForeignKey', ({(20, 28, 20, 38): '"""apis.Api"""'}, {}), "('apis.Api')", False, 'from django.db import models\n'), ((21, 18, 21, 42), 'django.db.models.BigIntegerField', 'models.BigIntegerField', ({}, {}), '()', False, 'from django.db import models\n'), ((22, 2... |
sachanacar/webex-assistant-sdk | webex_assistant_sdk/templates/mindmeld_template/{{cookiecutter.skill_name}}/{{cookiecutter.skill_name}}/__init__.py | bb0f1ad16973cfa5784d7d887381229fab01effa | # -*- coding: utf-8 -*-
from {{cookiecutter.skill_name}}.root import app
__all__ = ['app']
| [] |
donicrazy/ChatApp | backend/api/v1/dialogs/urls.py | ab129a9c0706bbb972cbce43283ba6e06d144635 | from django.urls import path
from backend.api.v1.dialogs.views import (
DialogListCreateView,
DialogRetrieveUpdateDestroyAPIView,
DialogMembershipListCreateView,
DialogMessageListCreateView,
DialogMessageRetrieveUpdateDestroyAPIView,
)
urlpatterns = [
path('', DialogListCreateView.as_view()),
... | [((11, 13, 11, 43), 'backend.api.v1.dialogs.views.DialogListCreateView.as_view', 'DialogListCreateView.as_view', ({}, {}), '()', False, 'from backend.api.v1.dialogs.views import DialogListCreateView, DialogRetrieveUpdateDestroyAPIView, DialogMembershipListCreateView, DialogMessageListCreateView, DialogMessageRetrieveUp... |
genouest/biomaj2galaxy | biomaj2galaxy/commands/init.py | 8c76f3cc96902d9401a03e7b1a6cd8f4a7ba17bd | # coding: utf-8
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import os
from bioblend import galaxy
from biomaj2galaxy import config, pass_context
from biomaj2galaxy.io import info, warn
import click
CONFIG_TEMPLATE = """## BioMAJ2Galaxy: Global Confi... | [((32, 1, 32, 16), 'click.command', 'click.command', ({}, {}), '()', False, 'import click\n'), ((38, 4, 38, 46), 'click.echo', 'click.echo', ({(38, 15, 38, 45): '"""Welcome to BioMAJ2Galaxy"""'}, {}), "('Welcome to BioMAJ2Galaxy')", False, 'import click\n'), ((61, 18, 61, 45), 'biomaj2galaxy.config.global_config_path',... |
josemrsantos/zoopla_datamart | datamart/tests/test_Dimension.py | f3a3af8071199deeb712d1814aecb6cc3cd88d57 | from ..datamart import *
def test_create_dimension():
dimension = Dimension("test_dimension")
assert dimension.is_degenerate == False
def test_create_dimension_insert_2_identical_lines():
''' with 2 identical lines, only one gets stored
'''
dimension = Dimension("test_dimension")
dimension.add... | [] |
PranjaliJain/matchmaker | preprocessing/convert_formats/msmarco_doc_create_train_input.py | b7e22eb8b70cccabf0729076df7cbab3f4ba4a1f | #
# msmarco doc: create the train.tsv triples
# -------------------------------
import random
random.seed(42)
import argparse
import os
import sys
from tqdm import tqdm
sys.path.append(os.getcwd())
from matchmaker.evaluation.msmarco_eval import *
from collections import defaultdict
from matchmaker.dataloaders.blin... | [((6, 0, 6, 15), 'random.seed', 'random.seed', ({(6, 12, 6, 14): '(42)'}, {}), '(42)', False, 'import random\n'), ((21, 9, 21, 34), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ({}, {}), '()', False, 'import argparse\n'), ((55, 12, 55, 32), 'matchmaker.dataloaders.bling_fire_tokenizer.BlingFireTokenizer', 'Bli... |
powerblossom/workcloud | tests/communities/test_reply.py | fd943220366ebeadfa90c59fc395f84a734b5686 | from core.response import Response
from communities.tests import TestCase
class ReplyPermissionTest(TestCase):
def setUp(self):
self.create_user(is_staff=True)
def test_permission_reply_all(self):
self.create_forum()
self.create_thread()
thread_id = self.thread.id
res... | [] |
noiseux1523/Deep-Belief-Network | examples/Word2Vec_AverageVectorsTuto.py | 6eb364a85fb128a33c539e5e414ef451f24e499d | # Author: Angela Chapman
# Date: 8/6/2014
#
# This file contains code to accompany the Kaggle tutorial
# "Deep learning goes to the movies". The code in this file
# is for Parts 2 and 3 of the tutorial, which cover how to
# train a model using Word2Vec.
#
# *************************************** #
# ****** Re... | [] |
PhiladelphiaController/phl-budget-data | src/phl_budget_data/etl/qcmr/positions/__init__.py | 438999017b8659de5bfb223a038f49fe6fd4a83a | from .core import FullTimePositions
| [] |
tzhanl/azure-sdk-for-python | sdk/loganalytics/azure-mgmt-loganalytics/azure/mgmt/loganalytics/models/search_get_schema_response.py | 18cd03f4ab8fd76cc0498f03e80fbc99f217c96e | # coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes ... | [] |
unhingedporter/DataStructureMustKnow | python/ds/spiralprint.py | 3c5b3225afa2775d37a2ff90121f73208717640a | # Python3 program to print
# given matrix in spiral form
def spiralPrint(m, n, a):
start_row_index = 0
start_col_index = 0
l = 0
''' start_row_index - starting row index
m - ending row index
start_col_index - starting column index
n - ending column index
i - iterator '''
while (start... | [] |
marintrace/backend | rest-api/routers/authorization.py | ad34bd50bd5e3f90be1ac16a74d39a0a9342fa33 | """
Authorization Utilities
"""
from shared.models.user_entities import User
from shared.service.jwt_auth_wrapper import JWTAuthManager
manager = JWTAuthManager(oidc_vault_secret="oidc/rest",
object_creator=lambda claims, assumed_role, user_roles: User(
first_name=... | [((8, 81, 13, 26), 'shared.models.user_entities.User', 'User', (), '', False, 'from shared.models.user_entities import User\n')] |
qnano/photonpy | photonpy/tests/psf_g2d_sigma.py | 9c03a1c9f4c2177c9c6fb3f2f16dfec2306006d4 | import matplotlib.pyplot as plt
import numpy as np
from photonpy.cpp.context import Context
import photonpy.cpp.gaussian as gaussian
from photonpy.smlm.util import imshow_hstack
from photonpy.cpp.estimator import Estimator
def CheckDeriv(psf:Estimator, theta):
nderiv,ev=psf.NumDeriv(theta,eps=1e-6)
deriv,ev=p... | [((16, 4, 16, 16), 'matplotlib.pyplot.figure', 'plt.figure', ({}, {}), '()', True, 'import matplotlib.pyplot as plt\n'), ((17, 4, 17, 39), 'photonpy.smlm.util.imshow_hstack', 'imshow_hstack', ({(17, 18, 17, 38): '(deriv[0] - nderiv[0])'}, {}), '(deriv[0] - nderiv[0])', False, 'from photonpy.smlm.util import imshow_hsta... |
Gautierhyp/tespy | tests/tools_tests/helpers_tests.py | d44ae41874baeff77619e560faea59dd0cb84c7c | # -*- coding: utf-8
"""Module for testing helper functions.
This file is part of project TESPy (github.com/oemof/tespy). It's copyrighted
by the contributors recorded in the version control history of the file,
available from its original location
tests/tools_tests/helpers_tests.py
SPDX-License-Identifier: MIT
"""
... | [((41, 13, 41, 70), 'tespy.tools.helpers.newton', 'newton', (), '', False, 'from tespy.tools.helpers import newton\n'), ((44, 4, 44, 25), 'nose.tools.eq_', 'eq_', ({(44, 8, 44, 11): '(4.0)', (44, 13, 44, 19): 'result', (44, 21, 44, 24): 'msg'}, {}), '(4.0, result, msg)', False, 'from nose.tools import eq_\n'), ((46, 13... |
ralfonso/theory | theory/model/form.py | 41684969313cfc545d74b306e409fd5bf21387b3 | import formencode
import pylons
from pylons import app_globals as g
class OutputSchema(formencode.Schema):
allow_extra_fields = False
enabled = formencode.validators.Int()
class ConfigForm(formencode.Schema):
allow_extra_fields = True
filter_extra_fields = True
#pre_validators = [formencode.Nest... | [] |
OnRails-IN/backend | utils/dynamo.py | 5f5c9703fcda282ed54f2e6315680fb30fd91a6f | """
Dynamo Utils
============
All utility functions for interactions with DynamoDB
Functions
- ensure_json
- create_user_table
- create_or_update_record
- list_tables
- list_records
- get_record
- delete_table
- delete_record
- check_active
"""
import boto3
from decimal import Deci... | [((23, 6, 29, 1), 'boto3.resource', 'boto3.resource', (), '', False, 'import boto3\n'), ((30, 9, 36, 1), 'boto3.client', 'boto3.client', (), '', False, 'import boto3\n')] |
gitana/cloudcms-python-driver | cloudcms/branch/__init__.py | 8685c634880c1a6af6f359f1a25de42dcf49f319 | from .branch import Branch | [] |
kubatom/my_nemtiko_repo | test2/test2.py | 842a303ae120d871623c267ea76c2353d70b2fce | print('this is a test2 file')
| [] |
yijiangh/compas | src/compas_blender/forms/__init__.py | a9e86edf6b602f47ca051fccedcaa88a5e5d3600 | """
********************************************************************************
compas_blender.forms
********************************************************************************
.. currentmodule:: compas_blender.forms
"""
__all__ = []
| [] |
cadappl/scm-workbench | Source/Git/Experiments/git_annotate.py | 302cdb8e36bb755f4977062e8977c37e7f4491f9 | #!/usr/bin/python3
import sys
import git
r = git.Repo( sys.argv[1] )
num = 0
for info in r.blame( 'HEAD', sys.argv[2] ):
num += 1
commit = info[0]
all_lines = info[1]
print( '%s %6d:%s' % (commit, num, all_lines[0]) )
for line in all_lines[1:]:
num += 1
print( '%*s %6d:%s' % (4... | [((6, 4, 6, 27), 'git.Repo', 'git.Repo', ({(6, 14, 6, 25): 'sys.argv[1]'}, {}), '(sys.argv[1])', False, 'import git\n')] |
HansikaPH/time-series-forecasting | configs/global_configs.py | 23be319a190489bc1464653a3d672edd70ab110b | # configs for the model training
class model_training_configs:
VALIDATION_ERRORS_DIRECTORY = 'results/validation_errors/'
INFO_FREQ = 1
# configs for the model testing
class model_testing_configs:
RNN_FORECASTS_DIRECTORY = 'results/rnn_forecasts/'
RNN_ERRORS_DIRECTORY = 'results/errors'
PROCESSED_R... | [] |
imaginal/openprocurement.blade | openprocurement/blade/tests/auctions.py | 4ef512e3d0c1287af1faca9caa9e5349a3c5b0fb | # -*- coding: utf-8 -*-
import unittest
from uuid import uuid4
from copy import deepcopy
from openprocurement.api.models import get_now
from openprocurement.edge.tests.base import AuctionBaseWebTest, test_award, test_auction_data, test_document, ROUTE_PREFIX
try:
import openprocurement.auctions.core as auctions_co... | [((13, 1, 13, 64), 'unittest.skipUnless', 'unittest.skipUnless', ({(13, 21, 13, 34): 'auctions_core', (13, 36, 13, 63): '"""Auctions is not reachable"""'}, {}), "(auctions_core, 'Auctions is not reachable')", False, 'import unittest\n'), ((340, 1, 340, 64), 'unittest.skipUnless', 'unittest.skipUnless', ({(340, 21, 340,... |
kejkz/webium | webium/controls/select.py | ccb09876a201e75f5c5810392d4db7a8708b90cb | from selenium.common.exceptions import NoSuchElementException
from selenium.webdriver.remote.webelement import WebElement
class Select(WebElement):
"""
Implements logic to work with Web List UI elements
"""
@property
def is_multiple(self):
value = self.get_attribute('multiple')
re... | [] |
zy-sunshine/falkon-pyqt5 | mc/cookies/CookieManager.py | bc2b60aa21c9b136439bd57a11f391d68c736f99 | from PyQt5.QtWidgets import QDialog
from PyQt5 import uic
from PyQt5.Qt import Qt
from PyQt5.Qt import QShortcut
from PyQt5.Qt import QKeySequence
from PyQt5.QtWidgets import QMessageBox
from PyQt5.QtWidgets import QInputDialog
from PyQt5.Qt import QDateTime
from PyQt5.Qt import QStyle
from PyQt5.Qt import QNetworkCook... | [((28, 19, 28, 66), 'PyQt5.uic.loadUi', 'uic.loadUi', ({(28, 30, 28, 59): '"""mc/cookies/CookieManager.ui"""', (28, 61, 28, 65): 'self'}, {}), "('mc/cookies/CookieManager.ui', self)", False, 'from PyQt5 import uic\n'), ((35, 8, 35, 48), 'mc.common.globalvars.gVar.appTools.centerWidgetOnScreen', 'gVar.appTools.centerWid... |
dongbohu/cimr-d | .circleci/process_submitted_data.py | 7d8f7f7319cff0092946a28d1416d38c06e085d7 | #!/usr/bin/env python3
import os
import sys
import logging
import subprocess
logging.basicConfig(level=logging.INFO)
root_dir = 'submitted_data'
submitted_file_split = set()
for dir_, _, files in os.walk(root_dir):
for file_name in files:
rel_dir = os.path.relpath(dir_, root_dir)
rel_file = os... | [((9, 0, 9, 39), 'logging.basicConfig', 'logging.basicConfig', (), '', False, 'import logging\n'), ((15, 22, 15, 39), 'os.walk', 'os.walk', ({(15, 30, 15, 38): 'root_dir'}, {}), '(root_dir)', False, 'import os\n'), ((17, 18, 17, 49), 'os.path.relpath', 'os.path.relpath', ({(17, 34, 17, 38): 'dir_', (17, 40, 17, 48): 'r... |
resourceidea/resourceideaapi | common/enums.py | 4cc7db98f981d8f2011c1995e23e8a8655e31f75 | import enum
class Status(enum.Enum):
"""Status enumeration."""
ACTIVE = 'ACTIVE'
DISABLED = 'DISABLED'
ARCHIVED = 'ARCHIVED'
DELETED = 'DELETED'
class ProgressStatus(enum.Enum):
"""Enumeration indicates the different
stages of the progress made on an engagement,
job or ... | [] |
softsys4ai/FlexiBO | networks/mobilenet.py | 1406d67e5bd14d6b7210e724e6b239889f210db6 | # Copyright 2019 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | [] |
altfool/mri_face_detection | info.py | 3117f7f00c98efe2260936146ce6b5454b059672 | import numpy as np
img_dtype = np.float32
imgX, imgY, imgZ = (256, 256, 150)
imgs_path_withfaces = '../dataset/withfaces'
imgs_path_nofaces = '../dataset/nofaces'
imgX_dwt1, imgY_dwt1, imgZ_dwt1 = (128, 128, 75)
imgs_path_withfaces_dwt = './dataset/withfaces'
imgs_path_nofaces_dwt = './dataset/nofaces'
dwt_flag = (... | [] |
zzz2010/Contrib | biggan/paddorch/paddorch/vision/functional.py | d351d83da718145cef9f6c98598f7fedc027efe5 | # Copyright (c) 2020 PaddlePaddle 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... | [((55, 11, 55, 41), 'cv2.flip', 'cv2.flip', (), '', False, 'import cv2\n'), ((163, 10, 170, 19), 'cv2.copyMakeBorder', 'cv2.copyMakeBorder', (), '', False, 'import cv2\n'), ((208, 8, 208, 61), 'cv2.getRotationMatrix2D', 'cv2.getRotationMatrix2D', (), '', False, 'import cv2\n'), ((75, 24, 75, 52), 'random.choice', 'rand... |
ashhansen6/minigames | ground_battle.py | 5b2e0db14b3567c9b6220206105ed448fb303551 | # -*- coding: utf-8 -*-
"""
Created on Fri Jan 29 13:38:35 2021
GROUND INVASION! The Game
@author: Ashton Hansen (ashhansen6@outlook.com)
"""
# Packages used:
import numpy as np
import pandas as pd
import random as rng
from termcolor import colored
# Defining starting forces
## Defenders:
def_force =... | [((41, 10, 41, 84), 'termcolor.colored', 'colored', (), '', False, 'from termcolor import colored\n'), ((67, 10, 67, 84), 'termcolor.colored', 'colored', (), '', False, 'from termcolor import colored\n'), ((98, 10, 98, 82), 'termcolor.colored', 'colored', (), '', False, 'from termcolor import colored\n'), ((124, 10, 12... |
martinheidegger/pretalx | src/pretalx/orga/urls.py | d812e665c1c5ce29df3eafc1985af08e4d986fef | from django.conf.urls import include, url
from django.views.generic.base import RedirectView
from pretalx.event.models.event import SLUG_CHARS
from pretalx.orga.views import cards
from .views import (
admin,
auth,
cfp,
dashboard,
event,
mails,
organiser,
person,
plugins,
review... | [((26, 4, 26, 53), 'django.conf.urls.url', 'url', (), '', False, 'from django.conf.urls import include, url\n'), ((102, 4, 102, 71), 'django.conf.urls.url', 'url', (), '', False, 'from django.conf.urls import include, url\n'), ((29, 14, 29, 64), 'django.views.generic.base.RedirectView.as_view', 'RedirectView.as_view', ... |
Malekhy/ws2122-lspm | ws2122-lspm/Lib/site-packages/pm4py/statistics/overlap/utils/compute.py | e4dc8b801d12f862b8ef536a0f125f346f085a00 | '''
This file is part of PM4Py (More Info: https://pm4py.fit.fraunhofer.de).
PM4Py is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any late... | [((49, 14, 49, 84), 'pm4py.util.exec_utils.get_param_value', 'exec_utils.get_param_value', ({(49, 41, 49, 59): 'Parameters.EPSILON', (49, 61, 49, 71): 'parameters', (49, 73, 49, 83): '10 ** -5'}, {}), '(Parameters.EPSILON, parameters, 10 ** -5)', False, 'from pm4py.util import exec_utils\n'), ((52, 11, 52, 25), 'interv... |
sk-Prime/webapp | webapp/apps/Base Quiz/baseui_gen.py | c21d7d49de4e4442f9af29ba9f08f37b5abbd20d | from htmlman import HTMLMan
from styleman import Template
page=HTMLMan()
page.make_responsive()
page.add_title("Base Quiz")
style=Template('antartica')
page.add_body_class(style['page'])
page.add_js("baseui.js")
page.create_section('main',append=True)
page['main'].add_style_class(style['main'])
title=page.create_sec... | [((4, 5, 4, 14), 'htmlman.HTMLMan', 'HTMLMan', ({}, {}), '()', False, 'from htmlman import HTMLMan\n'), ((7, 6, 7, 27), 'styleman.Template', 'Template', ({(7, 15, 7, 26): '"""antartica"""'}, {}), "('antartica')", False, 'from styleman import Template\n')] |
srcc-msu/job_statistics | cluster_config/cluster.py | 74680a4e4c105ebcff94f089e07fcb44dbcc12d9 | name = "cluster"
num_cores = 1000
GENERAL_PARTITIONS = ["regular"]
GPU_PARTITIONS = ["gpu"]
PARTITIONS = GENERAL_PARTITIONS + GPU_PARTITIONS
ACTIVE_JOB_STATES = ["RUNNING", "COMPLETING"]
FINISHED_JOB_STATES = ["COMPLETED", "NODE_FAIL", "TIMEOUT", "FAILED", "CANCELLED"]
JOB_STATES = ACTIVE_JOB_STATES + FINISHED_JOB_... | [] |
OmeGak/indico-plugins-cern | room_assistance/indico_room_assistance/plugin.py | 6e32bc158877080085ceffd021ab1d2247192f75 | # This file is part of the CERN Indico plugins.
# Copyright (C) 2014 - 2021 CERN
#
# The CERN Indico plugins are free software; you can redistribute
# them and/or modify them under the terms of the MIT License; see
# the LICENSE file for more details.
import dateutil.parser
import pytz
from flask import flash, request... | [((43, 48, 43, 63), 'indico_room_assistance._', '_', ({(43, 50, 43, 62): '"""Recipients"""'}, {}), "('Recipients')", False, 'from indico_room_assistance import _\n'), ((52, 49, 52, 77), 'indico_room_assistance._', '_', ({(52, 51, 52, 76): '"""Room assistance support"""'}, {}), "('Room assistance support')", False, 'fro... |
liangmuxin/datamart | datamart/materializers/wikidata_spo_materializer.py | 495a21588db39c9ad239409208bec701dca07f30 | from datamart.materializers.materializer_base import MaterializerBase
import os
import urllib.request
import sys
import csv
import copy
import json
from typing import List
from pprint import pprint
import re
import typing
from pandas import DataFrame
import traceback
class WikidataSPOMaterializer(MaterializerBase):
... | [((24, 8, 24, 49), 'datamart.materializers.materializer_base.MaterializerBase.__init__', 'MaterializerBase.__init__', ({(24, 34, 24, 38): 'self'}, {}), '(self, **kwargs)', False, 'from datamart.materializers.materializer_base import MaterializerBase\n'), ((61, 25, 61, 60), 're.sub', 're.sub', ({(61, 32, 61, 38): '"""\\... |
danilobellini/Axelrod | axelrod/load_data_.py | 2c9212553e06095c24adcb82a5979279cbdf45fb | from typing import Dict, List, Tuple
import pkg_resources
def load_file(filename: str, directory: str) -> List[List[str]]:
"""Loads a data file stored in the Axelrod library's data subdirectory,
likely for parameters for a strategy."""
path = "/".join((directory, filename))
data_bytes = pkg_resources... | [((10, 17, 10, 62), 'pkg_resources.resource_string', 'pkg_resources.resource_string', ({(10, 47, 10, 55): '__name__', (10, 57, 10, 61): 'path'}, {}), '(__name__, path)', False, 'import pkg_resources\n')] |
genobank-io/CryptoVault | prescryptchain/api/views.py | 7c2f6c4c55df7d9e172058aad334a26786ea839f | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
# REST
from rest_framework.viewsets import ViewSetMixin
from rest_framework import routers, serializers, viewsets
from rest_framework.authentication import SessionAuthentication, BasicAuthentication, TokenAuthentication
from rest_framework.permissions imp... | [((20, 9, 20, 32), 'rest_framework.routers.DefaultRouter', 'routers.DefaultRouter', ({}, {}), '()', False, 'from rest_framework import routers, serializers, viewsets\n'), ((25, 16, 25, 58), 'rest_framework.serializers.DateTimeField', 'serializers.DateTimeField', (), '', False, 'from rest_framework import routers, seria... |
stvreumi/pyre-check | client/commands/incremental.py | 94d13c8df37b53843ae92544b81042347b64315d | # Copyright (c) 2016-present, Facebook, Inc.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import atexit
import logging
import os
import subprocess
import sys
from typing import List
from .command import ClientException, ExitCode, State
f... | [((18, 6, 18, 33), 'logging.getLogger', 'logging.getLogger', ({(18, 24, 18, 32): '__name__'}, {}), '(__name__)', False, 'import logging\n'), ((68, 22, 68, 84), 'os.path.join', 'os.path.join', ({(68, 35, 68, 53): 'analysis_directory', (68, 55, 68, 83): '""".pyre/server/server.stdout"""'}, {}), "(analysis_directory, '.py... |
rish-raghu/Object-Goal-Navigation | main_random_policy.py | d2c882f3a97396c691fc75b46bd94bb7077f7d0f | from collections import deque, defaultdict
import os
import sys
import logging
import time
import json
import gym
import torch.nn as nn
import torch
import numpy as np
import matplotlib.pyplot as plt
from model import RL_Policy, Semantic_Mapping
from utils.storage import GlobalRolloutStorage
from envs import make_vec_... | [((23, 11, 23, 21), 'arguments.get_args', 'get_args', ({}, {}), '()', False, 'from arguments import get_args\n'), ((25, 4, 25, 29), 'numpy.random.seed', 'np.random.seed', ({(25, 19, 25, 28): 'args.seed'}, {}), '(args.seed)', True, 'import numpy as np\n'), ((26, 4, 26, 32), 'torch.manual_seed', 'torch.manual_seed', ({(2... |
Yulv-git/Awesome-Ultrasound-Standard-Plane-Detection | src/ITN/srmg/core/RiemannianRight.py | 2e35afaa891badf5a235b5d995102e4dc8a4cf0d | #!/usr/bin/env python
# coding=utf-8
'''
Author: Shuangchi He / Yulv
Email: yulvchi@qq.com
Date: 2022-03-19 10:33:38
Motto: Entities should not be multiplied unnecessarily.
LastEditors: Shuangchi He
LastEditTime: 2022-03-23 00:52:55
FilePath: /Awesome-Ultrasound-Standard-Plane-Detection/src/ITN/srmg/core/RiemannianRigh... | [((99, 8, 99, 22), 'numpy.zeros', 'numpy.zeros', ({(99, 20, 99, 21): '6'}, {}), '(6)', False, 'import numpy\n'), ((152, 8, 152, 22), 'numpy.zeros', 'numpy.zeros', ({(152, 20, 152, 21): '6'}, {}), '(6)', False, 'import numpy\n'), ((170, 9, 170, 27), 'numpy.zeros', 'numpy.zeros', ({(170, 21, 170, 26): '[6, 6]'}, {}), '([... |
StormDev87/VPH_bot_python | v0449gRpc_pb2.py | ae83a0b61e234912c0136ef0f176e7a88603ff28 | # -*- coding: utf-8 -*-
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: v0449gRpc.proto
"""Generated protocol buffer code."""
from google.protobuf import descriptor as _descriptor
from google.protobuf import descriptor_pool as _descriptor_pool
from google.protobuf import message as _message
from go... | [((12, 10, 12, 36), 'google.protobuf.symbol_database.Default', '_symbol_database.Default', ({}, {}), '()', True, 'from google.protobuf import symbol_database as _symbol_database\n'), ((29, 14, 33, 4), 'google.protobuf.reflection.GeneratedProtocolMessageType', '_reflection.GeneratedProtocolMessageType', ({(29, 55, 29, 6... |
AlexsLemonade/resources-portal | api/resources_portal/test/views/test_search_endpoint.py | d91c6c8d6135461faccbc78ef2b0be3f9b358f21 | import datetime
from django.core.management import call_command
from django.urls import reverse
from rest_framework import status
from rest_framework.test import APITestCase
from resources_portal.management.commands.populate_dev_database import populate_dev_database
from resources_portal.models import Material, Organ... | [((21, 8, 21, 31), 'resources_portal.management.commands.populate_dev_database.populate_dev_database', 'populate_dev_database', ({}, {}), '()', False, 'from resources_portal.management.commands.populate_dev_database import populate_dev_database\n'), ((24, 8, 24, 55), 'django.core.management.call_command', 'call_command... |
hboshnak/mindarmour | mindarmour/utils/logger.py | 0609a4eaea875a84667bed279add9305752880cc | # Copyright 2019 Huawei Technologies Co., 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 law or agreed to... | [((17, 10, 17, 33), 'logging.getLogger', 'logging.getLogger', ({(17, 28, 17, 32): '"""MA"""'}, {}), "('MA')", False, 'import logging\n'), ((66, 18, 66, 44), 'logging.Formatter', 'logging.Formatter', ({(66, 36, 66, 43): 'log_fmt'}, {}), '(log_fmt)', False, 'import logging\n'), ((69, 26, 69, 49), 'logging.StreamHandler',... |
teodoramilcheva/softuni-software-engineering | Python/Programming Basics/Simple Calculations/17. Daily Earnings.py | 98dc9faa66f42570f6538fd7ef186d2bd1d39bff | workdays = float(input())
daily_tips = float(input())
exchange_rate = float(input())
salary = workdays * daily_tips
annual_income = salary * 12 + salary * 2.5
net_income = annual_income - annual_income * 25 / 100
result = net_income / 365 * exchange_rate
print('%.2f' % result)
| [] |
satya77/transformer_rankers | bert_rerannker_eval.py | 0d2c20bd26041d887fb65102020a0b609ec967fc | from transformer_rankers.trainers import transformer_trainer
from transformer_rankers.datasets import dataset, preprocess_scisumm_ranked
from transformer_rankers.eval import results_analyses_tools
from transformers import BertTokenizer, BertForSequenceClassification
from sacred.observers import FileStorageObserver
fro... | [((15, 5, 15, 41), 'sacred.Experiment', 'Experiment', ({(15, 16, 15, 40): '"""BERT-ranker experiment"""'}, {}), "('BERT-ranker experiment')", False, 'from sacred import Experiment\n'), ((30, 16, 30, 64), 'transformers.BertTokenizer.from_pretrained', 'BertTokenizer.from_pretrained', ({(30, 46, 30, 63): '"""bert-base-cas... |
tonyfg/project_euler | python/p21.py | 3a9e6352a98faaa506056b42160c91bffe93838c | #Q: Evaluate the sum of all the amicable numbers under 10000.
#A: 31626
def divisor_sum(n):
return sum([i for i in xrange (1, n//2+1) if not n%i])
def sum_amicable(start, end):
sum = 0
for i in xrange(start, end):
tmp = divisor_sum(i)
if i == divisor_sum(tmp) and i != tmp:
... | [] |
Dysoncat/student-services-slas-chat-bot | check.py | 5d9c7105cef640c34018d260249b6a05b959e73f | import long_responses as long
# Returns the probability of a message matching the responses that we have
def messageProb(userMessage, recognizedWords, isSingleResponse=False, requiredWords=[]):
messageCertainty = 0
hasRequiredWords = True
# Counts how many words are present in each predefined message
... | [((97, 15, 97, 29), 'long_responses.unknown', 'long.unknown', ({}, {}), '()', True, 'import long_responses as long\n')] |
jdalzatec/streamlit-manizales-tech-talks | image_predictor/utils.py | 619af5edc79a22ed4cc9f50dd2d0379399357549 | from io import StringIO
import numpy as np
from h5py import File
from keras.models import load_model as keras_load_model
from PIL import Image, ImageOps
def predict(image, model):
# Create the array of the right shape to feed into the keras model
# The 'length' or number of images you can put into the array ... | [((13, 11, 13, 63), 'numpy.ndarray', 'np.ndarray', (), '', True, 'import numpy as np\n'), ((15, 12, 15, 29), 'PIL.Image.open', 'Image.open', ({(15, 23, 15, 28): 'image'}, {}), '(image)', False, 'from PIL import Image, ImageOps\n'), ((19, 12, 19, 54), 'PIL.ImageOps.fit', 'ImageOps.fit', ({(19, 25, 19, 30): 'image', (19,... |
emilywoods/docker-workshop | client/setup.py | 46fef25ed06ab33f653bebffdd837ee4cc31c373 | from setuptools import setup
setup(
name="workshop-client",
install_requires=["flask==1.1.1", "requests==2.22.0"],
python_requires=">=3.7",
classifiers=[
"Development Status :: 1 - Beta",
"License :: OSI Approved :: MIT License",
"Programming Language :: Python :: 3",
"P... | [((3, 0, 14, 1), 'setuptools.setup', 'setup', (), '', False, 'from setuptools import setup\n')] |
Socian-Ltd/python-facebook-1 | tests/facebook/models/test_photo.py | e9a4f626b37541103c9534a29342ef6033c09c06 | import json
import unittest
import pyfacebook.models as models
class PhotoModelTest(unittest.TestCase):
BASE_PATH = "testdata/facebook/models/photos/"
with open(BASE_PATH + 'photo.json', 'rb') as f:
PHOTO_INFO = json.loads(f.read().decode('utf-8'))
def testPhoto(self):
m = models.Photo.... | [((14, 12, 14, 60), 'pyfacebook.models.Photo.new_from_json_dict', 'models.Photo.new_from_json_dict', ({(14, 44, 14, 59): 'self.PHOTO_INFO'}, {}), '(self.PHOTO_INFO)', True, 'import pyfacebook.models as models\n')] |
curanaj/airbyte-dbt-demo | airbyte-integrations/connectors/source-scaffold-source-python/source_scaffold_source_python/source.py | f6b8ccd8f8e57b7ea84caf814b14d836338e8007 | # MIT License
#
# Copyright (c) 2020 Airbyte
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publ... | [((91, 15, 91, 46), 'airbyte_cdk.models.AirbyteCatalog', 'AirbyteCatalog', (), '', False, 'from airbyte_cdk.models import AirbyteCatalog, AirbyteConnectionStatus, AirbyteMessage, AirbyteRecordMessage, AirbyteStream, ConfiguredAirbyteCatalog, Status, Type\n'), ((58, 19, 58, 67), 'airbyte_cdk.models.AirbyteConnectionStat... |
SimplyVC/panic | alerter/src/monitorables/nodes/chainlink_node.py | 2f5c327ea0d14b6a49dc8f4599a255048bc2ff6d | from datetime import datetime
from typing import Optional, Dict, List, Union
from schema import Schema, Or
from src.monitorables.nodes.node import Node
from src.utils.exceptions import InvalidDictSchemaException
class ChainlinkNode(Node):
def __init__(self, node_name: str, node_id: str, parent_id: str) -> None:... | [((272, 24, 276, 14), 'schema.Or', 'Or', ({(272, 27, 276, 9): "{'address': str, 'balance': float, 'latest_usage': float}", (276, 11, 276, 13): '{}'}, {}), "({'address': str, 'balance': float, 'latest_usage': float}, {})", False, 'from schema import Schema, Or\n'), ((291, 18, 291, 68), 'src.utils.exceptions.InvalidDictS... |
petrapoklukar/DCA | experiments/vgg16/VGG16_utils.py | e5b3f3481433306a4b33e712272f8bbf5e9d05ce | import pickle
import numpy as np
import os
def _analyze_query_point_assignment(
query_data_dict: dict,
init_Rdata_dict: dict,
init_Edata_dict: dict,
num_R: int,
query_point_assignment_array: np.ndarray,
root: str,
n_points_to_copy=50,
):
"""
Analyzes and visualizes qDCA results.
... | [((113, 28, 113, 84), 'os.path.join', 'os.path.join', ({(113, 41, 113, 45): 'root', (113, 47, 113, 62): '"""visualization"""', (113, 64, 113, 83): '"""same_label_images"""'}, {}), "(root, 'visualization', 'same_label_images')", False, 'import os\n'), ((114, 29, 114, 86), 'os.path.join', 'os.path.join', ({(114, 42, 114,... |
Coldarra/RawFishSheep | back-end/RawFishSheep/app_cart/views.py | 266bd9d8d9832d5c692b63e7515d45fdc4f6acc4 | from .models import *
from decorator import *
from app_goods.views import getGoodsByID
# 查询当前用户所有的购物车信息
def getCartByUser(user_id=None):
if user_id == None:
raise ParamException()
return Cart.objects.filter(user_id=user_id)
def getSelectedCart(user_id=None):
if user_id == None:
raise P... | [((46, 7, 46, 29), 'app_goods.views.getGoodsByID', 'getGoodsByID', ({(46, 20, 46, 28): 'goods_id'}, {}), '(goods_id)', False, 'from app_goods.views import getGoodsByID\n')] |
johannesgiorgis/my-timewarrior-extensions | extensions/catsum.py | 1a8b83359298d3cbf002148f02b5ef6f1693a797 | #!/usr/bin/env python3
###############################################################################
#
# Category Summaries
#
#
###############################################################################
import datetime
import io
import json
import logging
import pprint
import sys
from typing import Dict, Any
... | [((22, 9, 22, 36), 'logging.getLogger', 'logging.getLogger', ({(22, 27, 22, 35): '__name__'}, {}), '(__name__)', False, 'import logging\n'), ((26, 12, 26, 35), 'logging.StreamHandler', 'logging.StreamHandler', ({}, {}), '()', False, 'import logging\n'), ((31, 11, 31, 40), 'logging.Formatter', 'logging.Formatter', ({(31... |
jnascimentocode/REST-API-COM-PYTHON-E-FLASK | resources/hotel.py | c55dca53f3a864c6c1aba8bbde63dcadc3c19347 | from typing import ParamSpecArgs
from flask_restful import Resource, reqparse
from models.hotel import HotelModel
from flask_jwt_extended import jwt_required
from models.site import SiteModel
from resources.filtros import *
import sqlite3
path_params = reqparse.RequestParser()
path_params.add_argument('cidade', type=s... | [((9, 14, 9, 38), 'flask_restful.reqparse.RequestParser', 'reqparse.RequestParser', ({}, {}), '()', False, 'from flask_restful import Resource, reqparse\n'), ((51, 17, 51, 41), 'flask_restful.reqparse.RequestParser', 'reqparse.RequestParser', ({}, {}), '()', False, 'from flask_restful import Resource, reqparse\n'), ((6... |
dmgolembiowski/magic-wormhole | src/wormhole/__main__.py | d517a10282d5e56f300db462b1a6eec517202af7 | from __future__ import absolute_import, print_function, unicode_literals
if __name__ == "__main__":
from .cli import cli
cli.wormhole()
else:
# raise ImportError('this module should not be imported')
pass
| [] |
Eliezer-Beczi/CNDP | testing/berge_equilibrium_cndp.py | 73decdfaef1c9e546ad94dd7448c89078af27034 | import networkx as nx
import utils.connectivity_metrics as connectivity_metric
from platypus import NSGAII, EpsMOEA, NSGAIII, EpsNSGAII, Problem, Dominance, Subset, TournamentSelector, \
HypervolumeFitnessEvaluator, Archive
import statistics
import multiprocessing as mp
G = nx.read_adjlist("input/Ventresca/Barabas... | [((8, 4, 8, 64), 'networkx.read_adjlist', 'nx.read_adjlist', ({(8, 20, 8, 63): '"""input/Ventresca/BarabasiAlbert_n500m1.txt"""'}, {}), "('input/Ventresca/BarabasiAlbert_n500m1.txt')", True, 'import networkx as nx\n'), ((18, 15, 18, 68), 'networkx.subgraph_view', 'nx.subgraph_view', (), '', True, 'import networkx as nx... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.