max_stars_repo_path stringlengths 3 269 | max_stars_repo_name stringlengths 4 119 | max_stars_count int64 0 191k | id stringlengths 1 7 | content stringlengths 6 1.05M | score float64 0.23 5.13 | int_score int64 0 5 |
|---|---|---|---|---|---|---|
app/operational/admin/__init__.py | Anioko/reusable | 0 | 12782651 | <filename>app/operational/admin/__init__.py
from app.operational.admin.views import admin # noqa
from app.operational.admin.users import admin # noqa
from app.operational.admin.contact import admin # noqa
from app.operational.admin.payment import admin # noqa
from app.operational.admin.pricingplan import admin # n... | 1.195313 | 1 |
convert_grayscale.py | Programista3/Python-OpenCV-Examples | 0 | 12782652 | <reponame>Programista3/Python-OpenCV-Examples
import cv2
image = cv2.imread('media/Leaves.jpg', 1) # Load a color image
gray = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY) # Convert image to grayscale
cv2.imshow('Image in grayscale', gray) # Show image
cv2.waitKey(0)
cv2.destroyAllWindows() | 3.78125 | 4 |
src/profiling_command.py | chilin0525/model-layer-profiling | 0 | 12782653 | <gh_stars>0
def generate_command(model_type, gpu_idx, command):
dlprof = "dlprof --reports all" + \
" --force=true" + \
" --mode=" + model_type + \
" --formats=json" + \
" --output_path=log " + command
return dlprof
| 1.75 | 2 |
src/striga/service/sitebus/_stsvcsb_view.py | ateska/striga | 0 | 12782654 | import os, logging as L
import striga.core.exception
import striga.server.application
from ._stsvcsb_utils import PathLimiter, LoabableObject
###
class View(PathLimiter, LoabableObject):
'''
Process bus object that executes Striga views
'''
def __init__(self, rootdir, source, mode, entry = 'main', pat... | 2.078125 | 2 |
emulator/emulatorui/stack.py | joshwatson/f-ing-around-with-binaryninja | 88 | 12782655 | <reponame>joshwatson/f-ing-around-with-binaryninja
from binaryninja import (BinaryDataNotification, BinaryReader,
BinaryView, BinaryViewType, Settings)
from PySide2.QtCore import QAbstractTableModel, Qt
from PySide2.QtGui import QFont
from PySide2.QtWidgets import QHeaderView, QTableView
clas... | 2.265625 | 2 |
lib/galaxy/job_metrics/formatting.py | rikeshi/galaxy | 1,085 | 12782656 | <reponame>rikeshi/galaxy
"""Utilities related to formatting job metrics for human consumption."""
class JobMetricFormatter:
"""Format job metric key-value pairs for human consumption in Web UI."""
def format(self, key, value):
return (str(key), str(value))
def seconds_to_str(value):
"""Convert ... | 3.078125 | 3 |
condolence_models/common.py | naitian/condolence-models | 2 | 12782657 | <reponame>naitian/condolence-models<filename>condolence_models/common.py<gh_stars>1-10
import logging
import os
import shutil
import tempfile
from itertools import islice
import requests
import torch
from tqdm import tqdm
from .bert_classifier.classifier import BertClassifier
from .bert_classifier.utils import prepro... | 2.21875 | 2 |
recipes/binutils/all/conanfile.py | dyndrite/conan-center-index | 1 | 12782658 | from conans import ConanFile, AutoToolsBuildEnvironment, tools
from conans.errors import ConanInvalidConfiguration
import functools
import os
import re
import typing
import unittest
required_conan_version = ">=1.43.0"
# This recipe includes a selftest to test conversion of os/arch to triplets (and vice verse)
# Run... | 2.234375 | 2 |
tests/homework_1/task_1/test_vector.py | pyaiveoleg/semester_4_python | 0 | 12782659 | import unittest
from homeworks.homework_1.task_1.vector import Vector
class VectorTest(unittest.TestCase):
def test_empty_vector(self):
with self.assertRaises(ValueError):
self.assertEqual(Vector([]).length(), 0)
def test_int_length(self):
self.assertEqual(Vector([3, 4]).length()... | 3.890625 | 4 |
aliyun-python-sdk-nlp-automl/aliyunsdknlp_automl/__init__.py | yndu13/aliyun-openapi-python-sdk | 1,001 | 12782660 | __version__ = '0.0.9' | 1.054688 | 1 |
tempstore/tempstore.py | ryanrichholt/tempstore | 0 | 12782661 | <filename>tempstore/tempstore.py
import os
import tempfile
import shutil
from collections import OrderedDict
class TempStore(object):
def __init__(self, name=None):
self.name = name
self.objs = OrderedDict()
self.dir = tempfile.TemporaryDirectory()
def cleanup(self):
"""Cleanu... | 3.375 | 3 |
recipe/import_test.py | regro-cf-autotick-bot/yeadon-feedstock | 22 | 12782662 | import yeadon
import yeadon.exceptions
import yeadon.human
import yeadon.inertia
import yeadon.segment
import yeadon.solid
import yeadon.ui
import yeadon.utils
import yeadon.tests
try:
import yeadon.gui
except ImportError: # mayavi not installed
pass
| 0.882813 | 1 |
sdk/attestation/azure-security-attestation/tests/preparers_async.py | rsdoherty/azure-sdk-for-python | 2,728 | 12782663 | <filename>sdk/attestation/azure-security-attestation/tests/preparers_async.py<gh_stars>1000+
# coding: utf-8
# -------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
... | 2.140625 | 2 |
glowtts/transformer/pe.py | revsic/tf-glow-tts | 5 | 12782664 | import numpy as np
import tensorflow as tf
class PositionalEncodings(tf.keras.Model):
"""Sinusoidal positional encoding generator.
"""
def __init__(self, channels: int, presize: int = 128):
"""Initializer.
Args:
channels: size of the channels.
presize: initial pe ca... | 2.46875 | 2 |
diskmth/DayGUI.py | Disk-MTH/How-to-install-python-on-windows | 1 | 12782665 | from tkinter import *
from PIL import Image, ImageTk
import Utils
import MainGUI
def day_gui(day_date):
# Create the frame
root = Tk()
# Initialisation of some useful variables
last_click_x = 0
last_click_y = 0
root_width = 700
root_height = 400
# Definition of some useful functio... | 3.28125 | 3 |
icIceFonksiyon.py | cyrionp/PythonLectures | 0 | 12782666 | <filename>icIceFonksiyon.py
def greeting(name):
print("Hello ",name)
'''
print(greeting("Ali"))
sayHello=greeting
print(sayHello)
print(greeting)
del sayHello
print(greeting)
#print(sayHello)
#Encapsulation
def outer(num1):
def inner_increment(num1):
return num1+1
num2=inner_increment(num1)
... | 3.921875 | 4 |
graphscale/kvetch/create_db.py | schrockntemp/graphscaletemp | 0 | 12782667 | <filename>graphscale/kvetch/create_db.py
#import pymysql
#import pymysql.cursors;
#import pytest
#from kvetch_dbschema import create_kvetch_edges_table_sql
#
#
#
#if __name__ == "__main__":
# conn = pymysql.connect(host='localhost',
# user='magnus',
# password='<PA... | 2 | 2 |
core/__init__.py | BenSmithers/MultiHex2 | 0 | 12782668 | from .coordinates import HexID, hex_to_screen, screen_to_hex
from .core import Hex,Region, Catalog, RegionCatalog, EntityCatalog
from .map_entities import Entity, Government, Settlement
from .core import DRAWSIZE | 1.054688 | 1 |
mrec/evaluation/__init__.py | imall100/mrec | 392 | 12782669 | class Evaluator(object):
"""
Compute metrics for recommendations that have been written to file.
Parameters
----------
compute_metrics : function(list,list)
The evaluation function which should accept two lists of predicted
and actual item indices.
max_items : int
The nu... | 3.171875 | 3 |
wab/core/emails/models.py | BinNguyenVNN/wab-rest | 0 | 12782670 | from django.db.models import BooleanField, CharField, TextField
from wab.core.components.models import BaseModel
class EmailTemplate(BaseModel):
code = CharField("Specific code for core app", max_length=50, blank=True, null=True, editable=False, unique=True)
is_protected = BooleanField("Is protected", defaul... | 2.171875 | 2 |
sort_teams.py | jhallman5/fencing_tournament | 0 | 12782671 | <filename>sort_teams.py<gh_stars>0
import sys
import csv
from linked_list import Node, Linked_List
from model import create_linked_list, determine_num_pools, create_init_pools
LL = create_linked_list()
num_pools = determine_num_pools(LL)
create_init_pools(LL, num_pools)
| 2.140625 | 2 |
Puzzles/Easy/TextFormatting.py | Naheuldark/Codingame | 0 | 12782672 | <reponame>Naheuldark/Codingame<filename>Puzzles/Easy/TextFormatting.py
import sys
import math
import re
text = input().lower().strip()
# Remove excessive spaces
text = re.sub(r'\s{2,}', ' ', text)
# Remove spaces before and after punctuations
text = re.sub(r'\s?[^\s\w\d]\s?', lambda match: match.group().strip(), tex... | 3.6875 | 4 |
admin_toolbox/apps.py | sarendsen/django-admin-toolbox | 12 | 12782673 | <reponame>sarendsen/django-admin-toolbox
from django.apps import AppConfig
class SidebarConfig(AppConfig):
name = 'admin_toolbox'
| 1.226563 | 1 |
scripts/plot_cumulative_time.py | christophebedard/christophebedard.github.io | 0 | 12782674 | #!/usr/bin/env python3
# Copyright 2021 <NAME>
#
# 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 agre... | 2.8125 | 3 |
ci.py | Glitter23/trying | 0 | 12782675 | <filename>ci.py
#Compounnd Interest
def ci(t,p,r):
A = p *((1+(r/100))**t)
CI = A - p
return CI
z=ci(4,50000,4)
print(z)
#amount
def amount(p,r,t):
A = p *((1+(r/100))**t)
return A
#rate
def rate(A,p,t):
r=((A/p)**(1/t)) - 1
return r
k=rate(90000,45000,2)
print... | 3.4375 | 3 |
Data Structures/Linked Lists/Singly Linked List/Single-linked-list-operations.py | siddhi-244/CompetitiveProgrammingQuestionBank | 931 | 12782676 | # A pythom program for all operations performed on singly linked-list.
# Time-Complexity = O(n)
# Space-Complexity = O(n)
class Node:
def __init__(self, data=None, next=None): # Creation of Node
self.data = data
self.next = next
class LinkedList:
def __init__(self):
self.head = None ... | 4.125 | 4 |
corrige_media/corrige_media.py | Arthurnevs/E1 | 0 | 12782677 | <filename>corrige_media/corrige_media.py
'''
UFCG
PROGRAMAÇÃO 1
<NAME> DE BRITO - 119210204
CORRIGE MEDIA
'''
nota1 = 10
nota2 = 5
media = (nota1 + nota2) / 2
print("Nota 1: {:4.1f}".format(nota1))
print("Nota 2: {:4.1f}".format(nota2))
print("Média : {:4.1f}".format(media))
| 2.40625 | 2 |
Exercicios Python/ex0018.py | AlanOliveira1998/ExerciciosPython01-100 | 0 | 12782678 | <gh_stars>0
#Faça um programa que leia o comprimento do cateto oposto e do cateto adjacente e calcule e mostre a sua hipotenusa
import math
co = float(input('Digite o valor do cateto oposto:'))
ca = float(input('Digite o valor do cateto adjacente:'))
h = math.hypot(co, ca)
print(f'O valor da hipotenusa corresponde a {h... | 3.828125 | 4 |
pytest_tornado/test/test_server.py | FRI-DAY/pytest-tornado | 0 | 12782679 | import functools
import pytest
import tornado.ioloop
import tornado.web
class MainHandler(tornado.web.RequestHandler):
def get(self):
self.write('Hello, world')
application = tornado.web.Application([
(r'/', MainHandler),
(r'/f00', MainHandler),
])
@pytest.fixture(scope='module')
def app():
... | 2.1875 | 2 |
geonode/geonode/api/resourcebase_api.py | ttungbmt/BecaGIS_GeoPortal | 0 | 12782680 | # -*- coding: utf-8 -*-
#########################################################################
#
# Copyright (C) 2016 OSGeo
#
# This program 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 ... | 1.648438 | 2 |
PythonBaseDemo/CommonModules/10.8/Counter_test2.py | CypHelp/TestNewWorldDemo | 0 | 12782681 | <reponame>CypHelp/TestNewWorldDemo
# coding: utf-8
#########################################################################
# 网站: <a href="http://www.crazyit.org">疯狂Java联盟</a> #
# author yeeku.H.lee <EMAIL> #
# ... | 3.171875 | 3 |
run.py | wellcomecollection/file_auditor | 0 | 12782682 | #!/usr/bin/env python2
from __future__ import print_function
import csv
import datetime
import errno
import hashlib
import os
import sys
import traceback
import zipfile
AUDIT_CSV_PATH = "audit.csv"
AUDIT_ZIPFILES_CSV_PATH = "audit_with_zipfile_entries.csv"
AUDIT_CSV_FIELDNAMES = ["path", "size", "last_modified_tim... | 2.921875 | 3 |
userlib/analysislib/andika/python BEC analysis/QgasUtils.py | specialforcea/labscript_suite | 0 | 12782683 | """
Created on Mon Sep 9 15:51:35 2013
QgasUtils: Basic Quantum Gas Utilities functions
@author: ispielman
Modified on Wed Dec 10 11:26: 2014
@author: aputra
"""
import numpy
import scipy.ndimage
def ImageSlice(xVals, yVals, Image, r0, Width, Scaled = False):
"""
Produces a pair of slices from image of a ... | 2.84375 | 3 |
adls_management/utils/settings.py | jacbeekers/metalake-file-management | 0 | 12782684 | <reponame>jacbeekers/metalake-file-management
import json
from adls_management.utils import messages
class GenericSettings:
"""
Some generic utilities, e.g. reading the config.json
"""
code_version = "0.1.0"
def __init__(self, configuration_file="resources/connection_config.json"):
# con... | 2.265625 | 2 |
src/strategy/Hand.py | fuqinshen/Python-- | 31 | 12782685 | HANDVALUE_GUU = 0
HANDVALUE_CHO = 1
HANDVALUE_PAA = 2
name = ["石头", "剪刀", "布"]
class Hand:
def __init__(self, handvalue):
self.handvalue = handvalue
@staticmethod
def get_hand(handvalue):
return hand[handvalue]
def is_stronger_than(self, h):
return self.fight(h) == 1
de... | 3.515625 | 4 |
data/train/python/6b731386581fcd9f07149ee9c71d2e795e33dc18__init__.py | harshp8l/deep-learning-lang-detection | 84 | 12782686 | # -*- coding: utf-8 -*-
# vim: sw=4 ts=4 fenc=utf-8 et
# ==============================================================================
# Copyright © 2010 UfSoft.org - <NAME> <<EMAIL>>
#
# License: BSD - Please view the LICENSE file for additional information.
# =========================================================... | 1.710938 | 2 |
utils/aneurysm_utils/evaluation.py | leoseg/AneurysmSegmentation | 1 | 12782687 | import os
import json
import multiprocessing
from matplotlib import pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
import numpy as np
import scipy as sp
import matplotlib.pyplot as plt
import matplotlib as mpl
import pandas as pd
import matplotlib.animation
from sklearn.model_selection import train_test_split
fr... | 1.828125 | 2 |
power_generalise_gs.py | syzhang/adec_power | 0 | 12782688 | <gh_stars>0
"""
simulated power calculation for generalisation instrumetnal avoidance task (with gen in model)
"""
import sys, os
import pickle
import numpy as np
import pandas as pd
import pystan
# from hbayesdm.models import generalise_gs
# from hbayesdm import rhat, print_fit, plot_hdi, hdi
def sigmoid(p):
retu... | 2.203125 | 2 |
pure_fa_exporter.py | zleinweber/pure-exporter | 22 | 12782689 | #!/usr/bin/env python
from flask import Flask, request, abort, make_response
from flask_httpauth import HTTPTokenAuth
from urllib.parse import parse_qs
import re
from prometheus_client import generate_latest, CollectorRegistry, CONTENT_TYPE_LATEST
from flasharray_collector import FlasharrayCollector
import logging
c... | 2.203125 | 2 |
LumiGAN/matplotlibstyle.py | acdc-pv-unsw/LumiGAN | 0 | 12782690 | "Defines matplotlib stylesheet"
import matplotlib as mpl
import matplotlib.pyplot as plt
import numpy as np
# %%-- Matplotlib style sheet
mpl.style.use('seaborn-paper')
mpl.rcParams['font.family'] = 'serif'
mpl.rcParams['font.serif'] ='STIXGeneral'
mpl.rcParams['font.size'] = 14
mpl.rcParams['mathtext.default'] = 'rm... | 2.515625 | 3 |
web-server/model/__init__.py | sanfengliao/DeepNavi | 0 | 12782691 | <gh_stars>0
from .map import *
from .edge import *
from .point import *
from .basic_pb2 import *
from .loc import * | 1.070313 | 1 |
solutions/2021/prob_07.py | PolPtoAmo/HPCodeWarsBCN | 1 | 12782692 | chars = list()
kjdas = False
for char in input().lower().replace(".", "").replace(",", "").replace("#", "").replace("'", "").replace("\"", "").replace(":", "").replace(";", "").replace("-", ""):
if char in chars:
print("Not an isogram")
kjdas = True
break
chars.append(char)
... | 4.03125 | 4 |
relevanceai/operations_new/cluster/ops.py | RelevanceAI/RelevanceAI | 21 | 12782693 | <reponame>RelevanceAI/RelevanceAI
import warnings
from copy import deepcopy
from typing import Optional, Union, Callable, Dict, Any, Set, List
from relevanceai.utils.decorators.analytics import track
from relevanceai.operations_new.apibase import OperationAPIBase
from relevanceai.operations_new.cluster.alias import... | 2.078125 | 2 |
subtask1/torch_ans_sel/run_model.py | DeepInEvil/NOESIS-II_deep | 0 | 12782694 | from data_utils import UDC
from transformer_rnn import TransformerRNN
from args import get_args
from eval import eval_model
import torch
import numpy as np
from tqdm import tqdm
import torch.optim as optim
import torch.nn.functional as F
from sklearn.metrics import f1_score
import torch.nn as nn
args = get_args()
if a... | 2.171875 | 2 |
lib/TaxaTransfer/InsertExternalDatabase.py | ZFMK/gbif2tnt | 0 | 12782695 | import logging
import logging.config
logger = logging.getLogger('sync_gbif2tnt')
import re
import pudb
from configparser import ConfigParser
config = ConfigParser()
config.read('config.ini')
from .InsertIntoTablesBase import InsertIntoTablesBase
class InsertExternalDatabaseBase(InsertIntoTablesBase):
def __init... | 2.34375 | 2 |
lightkurve/correctors/corrector.py | burke86/lightkurve | 0 | 12782696 | <filename>lightkurve/correctors/corrector.py<gh_stars>0
"""Implements the abstract `Corrector` base class.
"""
from abc import ABC, abstractmethod
import matplotlib
import numpy as np
from .. import LightCurve
from .metrics import overfit_metric_lombscargle, underfit_metric_neighbors
class Corrector(ABC):
"""Ab... | 2.578125 | 3 |
mmdet/datasets/coco_with_sub_image.py | ArthurWish/mmdetection | 0 | 12782697 | <reponame>ArthurWish/mmdetection<filename>mmdet/datasets/coco_with_sub_image.py
import os.path
from .builder import DATASETS
from .coco import CocoDataset
@DATASETS.register_module()
class CocoDatasetWithSubImage(CocoDataset):
def __init__(self, sub_images=(), **kwargs):
self.sub_images = sub_images
... | 2.359375 | 2 |
Beakjoon_Online_Judge/ready_winter.py | pkch93/Algorithm | 2 | 12782698 | <gh_stars>1-10
def solution(acorns):
n = len(acorns)
dp = [0]*n
for i in range(n):
temp = acorns[i]
if i == 0:
dp[i] = temp
else:
dp[i] = max(dp[i-1]+temp, temp)
acorns.sort(reverse=True)
smart = 0
for i in range(n):
if i != 0 and acorns[i]... | 3.0625 | 3 |
Financely/basic_app/get_stock_info.py | Frostday/Financely | 8 | 12782699 | import urllib.request, json
def getStockInfo(var):
var = var.replace(' ','')
url = "https://finance.yahoo.com/_finance_doubledown/api/resource/searchassist;searchTerm={}?device=console&returnMeta=true".format(var)
response = urllib.request.urlopen(url)
data = json.loads(response.read())
return data... | 3.09375 | 3 |
src/models/spikingpool2D.py | k-timy/snn_pytorch | 0 | 12782700 | <filename>src/models/spikingpool2D.py
"""
Author: <NAME>
April 2021
"""
import types
import torch
import torch.nn as nn
import torch.nn.functional as F
GLOBAL_DEBUG = False
class SpikingAveragePool2D(nn.Module):
"""
Applies a 2D Convolution transformation on the input spikes. And holds the states of
the ... | 3.375 | 3 |
tests/base_tests/linear_tests/test_translate.py | lycantropos/gon | 10 | 12782701 | <filename>tests/base_tests/linear_tests/test_translate.py
from typing import Tuple
from hypothesis import given
from gon.base import Linear
from gon.hints import Scalar
from . import strategies
@given(strategies.linear_geometries_with_coordinates_pairs)
def test_isometry(linear_with_steps: Tuple[Linear, Scalar, Sca... | 1.945313 | 2 |
statsig/statsig.py | ramikhalaf/python-sdk | 0 | 12782702 | <gh_stars>0
from .statsig_server import StatsigServer
__instance = StatsigServer()
def initialize(secretKey, options = None):
__instance.initialize(secretKey, options)
def check_gate(user, gate):
return __instance.check_gate(user, gate)
def get_config(user, config):
return __instance.get_config(user, co... | 1.898438 | 2 |
speedysvc/client_server/network/NetworkClient.py | mcyph/shmrpc | 4 | 12782703 | import time
import warnings
import socket
from _thread import allocate_lock
from os import getpid
from speedysvc.toolkit.documentation.copydoc import copydoc
from speedysvc.client_server.base_classes.ClientProviderBase import ClientProviderBase
from speedysvc.client_server.network.consts import len_packer, response_pa... | 2.328125 | 2 |
pyjdbc/java.py | manifoldai/pyjdbc | 2 | 12782704 | <reponame>manifoldai/pyjdbc<filename>pyjdbc/java.py
import jpype
from jpype import JClass
# Enable Java imports
from jpype import JArray
def get_url(path: str):
"""
Formats a given path into a url object.
Converts `/home/myfile.txt` into `file:/home/myfile.txt`
:param path:
:return:
"""
... | 2.625 | 3 |
repokid/utils/logging.py | maramSalamouny/repokid | 0 | 12782705 | <gh_stars>0
# Copyright 2020 Netflix, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by ap... | 2 | 2 |
tests/test_0123-atlas-issues.py | nikoladze/uproot4 | 0 | 12782706 | # BSD 3-Clause License; see https://github.com/scikit-hep/uproot4/blob/master/LICENSE
from __future__ import absolute_import
import pytest
import skhep_testdata
import uproot4
def test_version():
assert uproot4.classname_decode(
uproot4.classname_encode("xAOD::MissingETAuxAssociationMap_v2")
) == (... | 1.484375 | 1 |
cr_week6_test/scripts/robot_expression_prediction.py | Ani997/Human-Robot-Interaction- | 0 | 12782707 | <reponame>Ani997/Human-Robot-Interaction-
#!/usr/bin/env python
import rospy
from cr_week6_test.msg import perceived_info
from cr_week6_test.msg import robot_info
from cr_week6_test.srv import predict_robot_expression
import random
from bayesian_belief_networks.ros_utils import *
def human_expression_prob(human_expres... | 2.4375 | 2 |
cdrouter/users.py | qacafe/cdrouter.py | 4 | 12782708 | <reponame>qacafe/cdrouter.py
#
# Copyright (c) 2017-2020 by QA Cafe.
# All Rights Reserved.
#
"""Module for accessing CDRouter Users."""
import collections
from marshmallow import Schema, fields, post_load
from .cdr_error import CDRouterError
from .cdr_datetime import DateTime
from .filters import Field as field
cl... | 2.46875 | 2 |
nidhogg/__init__.py | ifxit/nidho | 11 | 12782709 | <reponame>ifxit/nidho
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from .sevenmode import SevenMode
from .clustermode import ClusterMode
from .core import NidhoggException
__all__ = ["get_netapp", "get_best_volume_by_size", "get_best_volume_by_quota"]
def get_netapp(url, username, password, veri... | 2.203125 | 2 |
bika/lims/browser/reports/qualitycontrol_referenceanalysisqc.py | hocinebendou/bika.gsoc | 0 | 12782710 | import json
import tempfile
from AccessControl import getSecurityManager
from DateTime import DateTime
from Products.CMFCore.utils import getToolByName
from Products.Five.browser.pagetemplatefile import ViewPageTemplateFile
from bika.lims import bikaMessageFactory as _
from bika.lims.utils import t, isAttributeHidden
... | 1.742188 | 2 |
tests/test_core.py | uezo/minette-python | 31 | 12782711 | import sys
import os
sys.path.append(os.pardir)
import pytest
from pytz import timezone
from logging import Logger, FileHandler, getLogger
from datetime import datetime
from types import GeneratorType
from minette import (
Minette, DialogService, SQLiteConnectionProvider,
SQLiteContextStore, SQLiteUserStore, S... | 2.1875 | 2 |
performance_vs_training.py | medvidov/IMaSC | 0 | 12782712 | <filename>performance_vs_training.py
from __future__ import unicode_literals, print_function
import plac
import random
import warnings
from pathlib import Path
import spacy
from spacy.util import minibatch, compounding
import json
import imblearn
from utils import prodigy_to_spacy
from metrics_clean import Metrics
fro... | 2.359375 | 2 |
pySDC/tests/test_Q_transfer.py | janEbert/pySDC | 0 | 12782713 | import nose
import numpy as np
from numpy.polynomial.polynomial import polyval
import pySDC.helpers.transfer_helper as th
from pySDC.core.Collocation import CollBase
from pySDC.tests.test_helpers import get_derived_from_in_package
classes = []
def setup():
global classes, t_start, t_end
# generate random bo... | 2.03125 | 2 |
examples/basic/hello_world_with_magic.py | osomdev/pyshrimp | 6 | 12782714 | #!/usr/bin/env pyshrimp
# $opts: magic
from pyshrimp import log, shell_cmd
print('You can run this as any other script')
print('But then what is the point? :)')
log('You can use log with a bit more details!')
log('The log is initialized by run... but with magic it gets magically invoked!')
log('To do that just add m... | 2.09375 | 2 |
src/modules/agents/__init__.py | simsimiSION/pymarl-algorithm-extension | 10 | 12782715 | <gh_stars>1-10
REGISTRY = {}
from .rnn_agent import RNNAgent
from .commnet_agent import CommAgent
from .g2a_agent import G2AAgent
from .maven_agent import MAVENAgent
REGISTRY["rnn"] = RNNAgent
REGISTRY['commnet'] = CommAgent
REGISTRY['g2a'] = G2AAgent
REGISTRY['maven'] = MAVENAgent
| 1.117188 | 1 |
tool/klint/fullstack/reg_util.py | kylerky/klint | 2 | 12782716 | import claripy
from kalm import utils
from . import ast_util
from . import spec_act
from . import spec_reg
# TODO: Akvile had put a cache here, which is a good idea since the read-then-write pattern is common;
# I removed it cause it depended on state.globals, but we should put it back somehow
def __constrain_... | 2.078125 | 2 |
cohesivenet/macros/admin.py | cohesive/python-cohesivenet-sdk | 0 | 12782717 | <reponame>cohesive/python-cohesivenet-sdk<gh_stars>0
import time
from typing import Dict, List
from cohesivenet import VNS3Client, data_types
from cohesivenet.macros import api_operations
def roll_api_password(
new_password, clients: List[VNS3Client]
) -> data_types.BulkOperationResult:
"""roll_api_password
... | 2.3125 | 2 |
streamlit_server_state/hash.py | whitphx/streamlit-server-state | 20 | 12782718 | from typing import Any, Optional, Tuple, Union
ReprHash = Union[str, int]
ObjDictHash = Optional[str]
Hash = Tuple[ReprHash, ObjDictHash]
def calc_hash(val: Any) -> Hash:
dict_hash: ObjDictHash = None
if hasattr(val, "__dict__") and isinstance(val.__dict__, dict):
dict_hash = repr(val.__dict__)
... | 2.890625 | 3 |
codigos-aula/cod3.py | maumneto/exercicio-python | 0 | 12782719 | <reponame>maumneto/exercicio-python<gh_stars>0
# import math
peso = float(input('Qual o seu peso: '))
altura = float(input('Qual a sua altura: '))
imc = peso/(altura*altura)
# imc = peso/(math.pow(altura, 2))
print('O resultado do IMC é ', imc) | 3.515625 | 4 |
run.py | Bidulman/bidoyon | 0 | 12782720 | from app import app
HOST = "localhost"
PORT = 5000
if __name__ == '__main__':
app.run(HOST, PORT, debug=True)
| 1.8125 | 2 |
aegea/top.py | lvreynoso/aegea | 57 | 12782721 | from __future__ import absolute_import, division, print_function, unicode_literals
import os, sys
from datetime import datetime
from typing import List
import boto3
import botocore.exceptions
from . import register_parser
from .util import ThreadPoolExecutor
from .util.printing import format_table, page_output
def ... | 2.28125 | 2 |
src/domain/cargo_space.py | KlemenGrebovsek/Cargo-stowage-optimization | 2 | 12782722 | from numpy import ndarray
from src.domain.cs_column import Column
import numpy as np
from src.model.stop_at_station_summary import StopAtStationSummary
class CargoSpace(object):
""" Represents cargo space in transport vehicle/ship ect.
"""
def __init__(self, width: int, height: int):
self._widt... | 2.625 | 3 |
src/pycropml/pparse.py | sielenk-yara/PyCrop2ML | 0 | 12782723 | """ License, Header
"""
from __future__ import absolute_import
from __future__ import print_function
from copy import copy
import xml.etree.ElementTree as xml
from . import modelunit as munit
from . import description
from . import inout
from . import parameterset as pset
from . import checking
from . import algorithm... | 2.375 | 2 |
tests/test_chi_water.py | noahkconley/city-scrapers | 0 | 12782724 | from datetime import date, time
import pytest
import json
from city_scrapers.spiders.chi_water import Chi_waterSpider
test_response = []
with open('tests/files/chi_water_test.json') as f:
test_response.extend(json.loads(f.read()))
spider = Chi_waterSpider()
# This line throws error
parsed_items = [item for item ... | 2.6875 | 3 |
database_service/run.py | Fox520/PaymentGateway | 1 | 12782725 | <reponame>Fox520/PaymentGateway
from db_api import app
app.run(host="0.0.0.0", port=6001, debug=True)
| 1.101563 | 1 |
src/sensor.py | VirtualWolf/esp32-air-quality-reader-mqtt | 1 | 12782726 | import gc
import uasyncio as asyncio
import ujson
import utime
from machine import UART, WDT
import ustruct as struct
import logger
from config import read_configuration
c = read_configuration()
wdt = WDT(timeout=600000)
async def start_readings(client):
while True:
logger.log('Initialising UART bus')
... | 2.53125 | 3 |
client/python/ProjectName/Client/__init__.py | KaNaDaAT/java-spring-template | 0 | 12782727 | # flake8: noqa
"""
OpenAPI definition
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) # noqa: E501
The version of the OpenAPI document: v0
Generated by: https://openapi-generator.tech
"""
__version__ = "0.1.0"
# import ApiClient
from Proj... | 1.054688 | 1 |
interpreter/lexical_analysis/lexer.py | rand0musername/CInterpreter | 0 | 12782728 | """ SCI - Simple C Interpreter """
from .token_type import *
from .token import Token
# maps strings that have a special meaning to corresponding tokens
RESERVED_KEYWORDS = {
'char': Token(CHAR, 'char'),
'int': Token(INT, 'int'),
'float': Token(FLOAT, 'float'),
'double': Token(DOUBLE, 'double'),
'... | 3.828125 | 4 |
utils/reader.py | syth0le/Neural-Networks-Labs | 0 | 12782729 | <reponame>syth0le/Neural-Networks-Labs<gh_stars>0
from typing import List
# from keras.datasets import mnist
from openpyxl import load_workbook
class Reader:
def __init__(self):
pass
# (train_X, train_y), (test_X, test_y) = mnist.load_data()
# self.train_X = train_X
# self.train_... | 2.765625 | 3 |
openpifpaf/train_instance_scorer.py | adujardin/openpifpaf | 0 | 12782730 | import json
import random
import pysparkling
import torch
from .decoder.utils.instance_scorer import InstanceScorer
from . import show
DATA_FILE = ('outputs/resnet101block5-pif-paf-edge401-190412-151013.pkl'
'.decodertraindata-edge641-samples0.json')
# pylint: skip-file
def plot_training_data(train_d... | 2.296875 | 2 |
inverter.py | akarasman/yolo-heatmaps | 0 | 12782731 | # trunk-ignore(black-py)
import torch
from torch.nn import Conv1d, Conv2d, Conv3d, MaxPool1d, MaxPool2d, MaxPool3d, Linear, Upsample
from lrp.utils import Flatten
from inverter_util import ( upsample_inverse, max_pool_nd_inverse,
max_pool_nd_fwd_hook, conv_nd_fwd_hook, linear_fwd_hook,
... | 1.9375 | 2 |
_modules/utils/html/escape(text)/tests.py | looking-for-a-job/django-examples | 0 | 12782732 | <filename>_modules/utils/html/escape(text)/tests.py
#!/usr/bin/env python
from django.utils.html import escape
"""
https://docs.djangoproject.com/en/dev/ref/utils/#django.utils.html.escape
escape(text)
"""
text = "<script>alert('test')</script>"
print(escape(text))
| 1.710938 | 2 |
admin/route_manager.py | modcastpodcast/link-shortener-backend | 4 | 12782733 | """
Module to take in a directory, iterate through it and create a Starlette routing map.
"""
import importlib
import inspect
from pathlib import Path
from typing import Union
from starlette.routing import Route as StarletteRoute, Mount
from nested_dict import nested_dict
from admin.route import Route
def construct... | 3.015625 | 3 |
bayesian_linear_regressor.py | KoyoteScience/BayesianLinearRegressor | 0 | 12782734 | import numpy as np
class BayesLinearRegressor:
def __init__(self, number_of_features, alpha=1e6):
'''
:param number_of_features: Integer number of features in the training rows, excluding the intercept and output values
:param alpha: Float inverse ridge regularizaiton constant, set to 1e... | 3.0625 | 3 |
opennre/tokenization/word_piece_tokenizer.py | WinterSoHot/OpenNRE | 3,284 | 12782735 | <filename>opennre/tokenization/word_piece_tokenizer.py
# coding=utf-8
# Copyright 2018 The Google AI Language Team Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.... | 2.578125 | 3 |
indy_node/server/req_handlers/read_req_handlers/get_revoc_reg_handler.py | rantwijk/indy-node | 0 | 12782736 | <reponame>rantwijk/indy-node
from plenum.server.request_handlers.handler_interfaces.read_request_handler import ReadRequestHandler
class GetRevocRegHandler(ReadRequestHandler):
pass
| 1.421875 | 1 |
generate_maze.py | temibabs/MPHRL | 8 | 12782737 | <filename>generate_maze.py<gh_stars>1-10
import os
import numpy as np
import tensorflow as tf
from config import c, n
import utils
def calc_lookat(corridors):
l, t, r, b = zip(* [i['pos'] for i in corridors])
min_l = min(l)
max_r = max(r)
min_b = min(b)
max_t = max(t)
return [np.mean([min_l,... | 2.671875 | 3 |
discordbot.py | umeharaumeo/discordpy-startup | 0 | 12782738 | <filename>discordbot.py
import discord
import os
token = os.environ['TOKEN_ON_TOKEN']
# 接続に必要なオブジェクトを生成
client = discord.Client()
# メッセージ受信時に動作する処理
@client.event
async def on_message(message):
# メッセージ送信者がBotだった場合は無視する
if message.author.bot:
return
if message.content == 'ID':
embed = disc... | 2.59375 | 3 |
boto/redshift/layer1.py | adastreamer/boto | 1 | 12782739 | # Copyright (c) 2013 Amazon.com, Inc. or its affiliates. All Rights Reserved
#
# 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 ... | 1.296875 | 1 |
tests/test_groupings.py | p-snft/oemof.network | 0 | 12782740 | <reponame>p-snft/oemof.network
""" Specific tests for the `oemof.groupings` module.
Most parts of the `groupings` module are tested via other tests, but certain
code paths don't get covered by those, which is what this module is for.
This file is part of project oemof (github.com/oemof/oemof). It's copyrighted
by the... | 2.46875 | 2 |
LC/448.py | szhu3210/LeetCode_Solutions | 2 | 12782741 | class Solution(object):
def findDisappearedNumbers0(self, nums):
"""
:type nums: List[int]
:rtype: List[int]
"""
if not nums:
return []
nums.append(len(nums)+1)
nums.append(0)
nums.sort()
res = []
last ... | 3.21875 | 3 |
minst/model.py | oriolromani/minst-dataset | 44 | 12782742 | import copy
import json
import jsonschema
import logging
import pandas as pd
import os
from sklearn.cross_validation import train_test_split
import minst.utils as utils
logger = logging.getLogger(__name__)
class MissingDataException(Exception):
pass
class Observation(object):
"""Document model each item i... | 2.59375 | 3 |
Curso_em_Video_Exercicios/ex067.py | Cohuzer/Exercicios-do-Curso-em-Video | 0 | 12782743 | <filename>Curso_em_Video_Exercicios/ex067.py
#Tabauada dos números digitados pelo úsuario- para qnd o valor for negativo
while True:
print('-' * 30)
n = int(input('QUAL TABUADA VOCÊ DESEJA VER? '))
print('-' * 30)
c = 0
if n < 0:
break
while c != 11:
print(f'{n} X {c} = {n * c}')... | 3.609375 | 4 |
mlmodels/model_tf/misc/tf_nlp/language-detection/1.fast-text-ngrams.py | gitter-badger/mlmodels | 1 | 12782744 | <filename>mlmodels/model_tf/misc/tf_nlp/language-detection/1.fast-text-ngrams.py
#!/usr/bin/env python
# coding: utf-8
# In[1]:
import re
import time
import numpy as np
import pandas as pd
import tensorflow as tf
from sklearn import metrics
from sklearn.feature_extraction.text import CountVectorizer
from sklearn.mo... | 2.640625 | 3 |
app/models/group.py | Saevon/PersOA | 2 | 12782745 | <reponame>Saevon/PersOA
from django.db import models
from app.constants.database import MAX_CHAR_LENGTH
from app.models.abstract import AbstractPersOAModel
from itertools import chain
from utils.decorators import seeded
class TraitGroup(AbstractPersOAModel):
"""
A grouping for Traits.
"""
name = mode... | 2.453125 | 2 |
tests/test_tutorial/importers/test_tutorial001.py | ta4tsering/openpecha-toolkit | 1 | 12782746 | from pathlib import Path
from docs_src.importers.hfml.tutorial001 import result
def test_hfml_base():
output_fn = Path("tests") / "formatters" / "hfml" / "data" / "kangyur_base.txt"
expected = output_fn.read_text()
assert result == expected
| 2.1875 | 2 |
lib/mapper/label.py | hashnfv/hashnfv-domino | 0 | 12782747 | #!/usr/bin/env python
#
# Licence statement goes here
#
#from toscaparser.tosca_template import ToscaTemplate
#Current version:
#Parses policy rules, extracts targets, extracts policy properties
#Returns set of policy properties for each target in a dictionary object
#e.g., node_labels['VNF1'] = {label1, label2, ...... | 2.40625 | 2 |
main/codeSamples/DataStructures/binary_trees/0x00-python-binary_trees/0-binary_tree.py | JKUATSES/dataStructuresAlgorithms | 0 | 12782748 | <gh_stars>0
#!/usr/bin/python3
"""0-binary_tree module defines classes for creating
and interacting with a binary tree
"""
class Node:
""" Class Node defines the structure of a single node of a binary tree
Attributes:
__data: Int value held by the node
__left: Pointer to the left child of a p... | 4.25 | 4 |
python_collector/peimar/inverter/config.py | cislow970/raspberry-solar-mon | 6 | 12782749 | import array as arr
import pytz
# Owned
__project__ = "peimar"
__author__ = "<NAME>"
__license__ = "MIT"
__version__ = "0.0.4"
__date__ = "02/11/2021"
__email__ = "<<EMAIL>>"
# Inverter Web Server
inverter_server = "192.168.1.8"
inverter_port = 80
# Inverter metric decimals
cf = arr.array('I', [0, 2, 1, 2, 1, 1, 2,... | 2.28125 | 2 |
AD14-flask-admin-backup-demo/app/admin_backup/__init__.py | AngelLiang/Flask-Demos | 3 | 12782750 | import os
from sqlalchemy.exc import IntegrityError, InvalidRequestError
from .backup import Backup
from .serializer import Serializer
from .autoclean import BackupAutoClean
from .mixins import AdminBackupModelViewMixin
from .fileadmin import BackupFileAdmin
class FlaskAdminBackup:
def __init__(self, app=None, ... | 2.25 | 2 |