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 |
|---|---|---|---|---|---|---|
scripts/mc_counting_same_origin.py | jonassagild/Track-to-Track-Fusion | 4 | 23900 | """
script to run mc sims on the three associations techniques when the tracks origin are equal. Used to calculate the
total number of correctly associating tracks and total # falsly not associating tracks from the same target.
"""
import numpy as np
from stonesoup.types.state import GaussianState
from data_associati... | 2.15625 | 2 |
c4/system/history.py | Brewgarten/c4-system-manager | 0 | 23901 | """
Copyright (c) IBM 2015-2017. All Rights Reserved.
Project name: c4-system-manager
This project is licensed under the MIT License, see LICENSE
"""
from abc import ABCMeta, abstractmethod
class DeviceHistory(object):
"""
Device manager history
"""
__metaclass__ = ABCMeta
@abstractmethod
def... | 2.796875 | 3 |
Modules/Helpers/Bomb/SerialNumber.py | cweeks12/KTANE-Solver | 0 | 23902 | <reponame>cweeks12/KTANE-Solver
class SerialNumber:
def __init__(self, serialNumber):
if not (len(serialNumber) == 6):
raise ValueError('Serial Number must be 6 digits long')
self._serialNumber = serialNumber
def __str__(self):
return 'S/N: {}'.format(self._serialNumb... | 3.21875 | 3 |
zkfarmer/utils.py | artarik/zkfarmer | 0 | 23903 | import json
import operator
import logging
import re
import time
from socket import socket, AF_INET, SOCK_DGRAM
from functools import reduce
logger = logging.getLogger(__name__)
def ip():
"""Find default IP"""
ip = None
s = socket(AF_INET, SOCK_DGRAM)
try:
s.connect(('172.16.31.10', 9))
... | 2.609375 | 3 |
support/update_dht_servers.py | sonofmom/ton-zabbix-scripts | 0 | 23904 | #!/usr/bin/env python3
#
import sys
import os
sys.path.append(os.path.dirname(os.path.dirname(os.path.realpath(__file__))))
import argparse
import Libraries.arguments as ar
import Libraries.tools.general as gt
import Libraries.tools.zabbix as zt
import Classes.AppConfig as AppConfig
import requests
import copy
def r... | 2.265625 | 2 |
src/data/dbConnection.py | leonardoleyva/api-agenda-uas | 1 | 23905 | <gh_stars>1-10
from firebase_admin import firestore
from google.cloud.firestore_v1.base_client import BaseClient
from ..core.app import App
class DBConnection(App):
def __init__(self) -> None:
super().__init__()
self.__db: BaseClient = firestore.client()
def getDBInstance(self) -> BaseClient... | 2.21875 | 2 |
math/PowerModPower.py | silvioedu/HackerRank-Python-Practice | 0 | 23906 | <gh_stars>0
if __name__ == '__main__':
a, b, m = int(input()),int(input()),int(input())
print(pow(a,b))
print(pow(a,b,m)) | 2.59375 | 3 |
test_autolens/integration/tests/imaging/lens_only/mock_nlo/lens_light__hyper_bg_noise.py | PyJedi/PyAutoLens | 1 | 23907 | <gh_stars>1-10
from test_autolens.integration.tests.imaging.lens_only import lens_light__hyper_bg_noise
from test_autolens.integration.tests.imaging.runner import run_a_mock
class TestCase:
def _test__lens_light__hyper_bg_noise(self):
run_a_mock(lens_light__hyper_bg_noise)
| 1.5625 | 2 |
pyleecan/Methods/Slot/HoleM51/_comp_point_coordinate.py | IrakozeFD/pyleecan | 95 | 23908 | from numpy import exp, pi, cos, sin, tan
from ....Functions.Geometry.inter_line_circle import inter_line_circle
def _comp_point_coordinate(self):
"""Compute the point coordinates needed to plot the Slot.
Parameters
----------
self : HoleM51
A HoleM51 object
Returns
-------
point_... | 3.296875 | 3 |
Python/cs611python.py | david145/CS6112018 | 0 | 23909 | print("\n")
print("PythonExercises-v2 by <NAME>")
print("\n")
print("=== EXERCISE 1 ===")
print("\n")
print("(a) 5 / 3 = " + str(5 / 3))
print("=> with python3 you can receive a float even if you divide two \
integers")
print("\n")
print("(b) 5 % 3 = " + str(5 % 3))
print("=> % is the modulus which divides left hand... | 4.5 | 4 |
src/usgsgeomag.py | jake9wi/spaceweather | 0 | 23910 | <gh_stars>0
"""Plot USGS geomag data."""
import argparse
import pathlib as pl
import datetime as dt
import matplotlib; matplotlib.use('cairo')
import matplotlib.pyplot as plt
import matplotlib.dates as mdates
import matplotlib.ticker as mticker
import requests
import pandas as pd
import funcs
funcs.check_cwd(pl.Path.c... | 2.796875 | 3 |
checkov/terraform/checks/resource/kubernetes/PodSecurityContext.py | pmalkki/checkov | 0 | 23911 | from checkov.common.models.enums import CheckCategories, CheckResult
from checkov.terraform.checks.resource.base_resource_check import BaseResourceCheck
class PodSecurityContext(BaseResourceCheck):
def __init__(self):
# CIS-1.5 5.7.3
name = "Apply security context to your pods and containers"
... | 2.09375 | 2 |
hardware/demo_i2c.py | leeehuang/MaixPy_scripts | 0 | 23912 | <filename>hardware/demo_i2c.py
from machine import I2C
# i2c = I2C(I2C.I2C0, freq=100000, scl=28, sda=29) # hardware i2c
i2c = I2C(I2C.I2C3, freq=100000, scl=28, sda=29) # software i2c
devices = i2c.scan()
print(devices)
for device in devices:
i2c.writeto(device, b'123')
i2c.readfrom(device, 3)
# tmp = b... | 2.734375 | 3 |
repos/system_upgrade/common/models/selinux.py | sm00th/leapp-repository | 0 | 23913 | <filename>repos/system_upgrade/common/models/selinux.py
from leapp.models import fields, Model
from leapp.topics import SystemInfoTopic, TransactionTopic
class SELinuxModule(Model):
"""SELinux module in cil including priority"""
topic = SystemInfoTopic
name = fields.String()
priority = fields.Integer(... | 2.296875 | 2 |
dateinfer/__init__.py | avishai-o/dateinfer | 0 | 23914 | <gh_stars>0
__author__ = '<EMAIL>'
from .infer import infer
| 1.179688 | 1 |
annotator_web.py | j20100/Seg_Annotator | 0 | 23915 | #!/usr/bin/python3
# -*- coding: utf-8 -*-
import argparse
import base64
from bson import ObjectId
import datetime
from flask import Flask, Markup, Response, abort, escape, flash, redirect, \
render_template, request, url_for
from flask_login import LoginManager, UserMixin, current_user, login_requir... | 2.265625 | 2 |
marrow/interface/__init__.py | marrow/interface | 2 | 23916 | from .meta import Interface
from .release import version as __version__
| 1.070313 | 1 |
apps/steam.py | nestorcalvo/Buencafe_dashboard | 0 | 23917 | import dash
import dash_core_components as dcc
import dash_bootstrap_components as dbc
import dash_html_components as html
import pandas as pd
import plotly.express as px
import plotly.graph_objs as go
from datetime import date
import dash_loading_spinners as dls
from dash.dependencies import Input, Output, ClientsideF... | 2.46875 | 2 |
ibeatles/step1/data_handler.py | indudhiman/bragg-edge | 0 | 23918 | <reponame>indudhiman/bragg-edge
import sys
import os
import glob
import pprint
import numpy as np
try:
import PyQt4.QtGui as QtGui
from PyQt4.QtGui import QFileDialog
except:
import PyQt5.QtGui as QtGui
from PyQt5.QtWidgets import QFileDialog
from ibeatles.utilities.load_files import LoadFiles, LoadTi... | 1.898438 | 2 |
touca/_case.py | trytouca/touca-python | 11 | 23919 | # Copyright 2021 Touca, Inc. Subject to Apache-2.0 License.
from ._types import IntegerType, VectorType, ToucaType
from datetime import datetime, timedelta
from enum import Enum
from typing import Dict, Tuple
class ResultCategory(Enum):
""" """
Check = 1
Assert = 2
class ResultEntry:
"""
Wrapp... | 3.046875 | 3 |
app/main/models/utils.py | tmeftah/e-invoice | 2 | 23920 | from datetime import datetime
import sqlalchemy as sa
from flask_sqlalchemy import Model
from sqlalchemy import ForeignKey
from sqlalchemy.ext.declarative import declared_attr
from sqlalchemy.orm import relationship
from app.main.extensions import db
class BaseMixin(Model):
def save_to_db(self):
try:
... | 2.59375 | 3 |
source/tides.py | agstub/viscoelastic-glines | 0 | 23921 | #-------------------------------------------------------------------------------
# This function defines the sea level change timeseries for marine ice sheet problem.
# *Default = sinusoidal tidal cycle if 'tides' with 1m amplitude if 'tides' turned 'on', OR...
# = zero if 'tides' turned 'off'
#---------------... | 3.140625 | 3 |
nucleotidefrequencies.py | TaliaferroLab/AnalysisScripts | 0 | 23922 | <filename>nucleotidefrequencies.py
#Usage: python nucleotidefrequencies.py <fasta file> <output file>
#Output is tab delimited frequencies of A, G, C, U
from Bio import SeqIO
import sys
def getfreqs(fasta):
freqs = [] #[afreq, gfreq, cfreq, ufreq]
a = 0
u = 0
c = 0
g = 0
tot = 0
for record in SeqIO.parse(fasta... | 3.125 | 3 |
pytuber/version.py | tefra/pytube.fm | 8 | 23923 | <gh_stars>1-10
version = "20.1"
| 1.03125 | 1 |
2d-lin_sep.py | rzepinskip/optimization-svm | 0 | 23924 | <gh_stars>0
import numpy as np
from matplotlib import pyplot as plt
from optsvm.svm import SVM
x_neg = np.array([[3, 4], [1, 4], [2, 3]])
y_neg = np.array([-1, -1, -1])
x_pos = np.array([[6, -1], [7, -1], [5, -3]])
y_pos = np.array([1, 1, 1])
x1 = np.linspace(-10, 10)
x = np.vstack((np.linspace(-10, 10), np.linspace(-... | 2.28125 | 2 |
src/decorators/location_decorator.py | AAU-PSix/canary | 0 | 23925 |
from typing import List, Dict
from ts.c_syntax import CSyntax
from ts import Tree
from cfa import CFANode, CFA, CFAEdge
from cfa import LocalisedCFA, LocalisedNode
from .tweet_handler import TweetHandler
from .decoration_strategy import StandardDecorationStrategy, DecorationStrategy
from .conversion_strategy import Co... | 2.59375 | 3 |
pydicom_ext/pydicom_series.py | shinaji/pydicom_ext | 0 | 23926 | <filename>pydicom_ext/pydicom_series.py
# dicom_series.py
"""
By calling the function read_files with a directory name or list
of files as an argument, a list of DicomSeries instances can be
obtained. A DicomSeries object has some attributes that give
information about the serie (such as shape, sampling, suid) and... | 3.046875 | 3 |
tutorials/poplar/tut3_vertices/test/test_tut3.py | xihuaiwen/chinese_bert | 0 | 23927 | # Copyright 2020 Graphcore Ltd.
from pathlib import Path
import pytest
# NOTE: The import below is dependent on 'pytest.ini' in the root of
# the repository
from examples_tests.test_util import SubProcessChecker
working_path = Path(__file__).parent
class TestBuildAndRun(SubProcessChecker):
def setUp(self):
... | 2.15625 | 2 |
mboxstats/mboxstats.py | ruettet/mailboxstatistics | 0 | 23928 | <filename>mboxstats/mboxstats.py
import codecs
import locale
from mailbox import mbox
from re import sub
from re import compile
from re import IGNORECASE
from datetime import datetime
from collections import Counter
class MailboxStatistics(object):
def __init__(self):
""" Generic MailboxStatistics object ... | 3.046875 | 3 |
utils.py | Project-VULMA/street-vulma | 0 | 23929 | from PIL import Image
import imagehash
from dotenv import load_dotenv
load_dotenv()
import google_streetview.api
import os
from shapely.geometry import shape, Polygon, Point
def get_point_photo(coords, download_folder):
# Define parameters for street view api
params_0 = [{
'size': '640x640', # max 640x640 pixels
... | 2.640625 | 3 |
19/solution.py | studiosi/AoC2015 | 0 | 23930 | <gh_stars>0
import re
import copy
import random
changes = {}
chain = ""
lines = open('input.txt').readlines()
moreChanges = True
for l in lines:
l = l.strip()
if moreChanges and l != "":
x = l.split("=>")
if x[0].strip() not in changes.keys():
changes[x[0].strip()] = []
chan... | 2.6875 | 3 |
core/migrations/0002_meetup.py | hatsem78/django_docker_nginex_nginx_gunicorn | 0 | 23931 | <gh_stars>0
# Generated by Django 2.2.16 on 2020-09-29 23:21
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('core', '0001_initial'),
]
operations = [
migrations.CreateModel(
name='Meetup',
fields=[
... | 1.914063 | 2 |
src/attendance/card_reader.py | JakubBatel/Attendance-Recorder | 0 | 23932 | <reponame>JakubBatel/Attendance-Recorder<filename>src/attendance/card_reader.py
from .resources.config import config
from .utils import reverse_endianness
from abc import ABC
from abc import abstractmethod
from logging import getLogger
from logging import Logger
from time import sleep
from typing import Final
import ... | 3.046875 | 3 |
medios/diarios/diario.py | miglesias91/dicenlosmedios | 1 | 23933 | import dateutil
import yaml
import feedparser as fp
import newspaper as np
from medios.medio import Medio
from medios.diarios.noticia import Noticia
from bd.entidades import Kiosco
class Diario(Medio):
def __init__(self, etiqueta):
Medio.__init__(self, etiqueta)
self.noticias = []
self.f... | 2.671875 | 3 |
yocto/poky/bitbake/lib/bb/ui/crumbs/hobcolor.py | jxtxinbing/ops-build | 16 | 23934 | <filename>yocto/poky/bitbake/lib/bb/ui/crumbs/hobcolor.py
#
# BitBake Graphical GTK User Interface
#
# Copyright (C) 2012 Intel Corporation
#
# Authored by <NAME> <<EMAIL>>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 2 as... | 1.53125 | 2 |
tfx/experimental/pipeline_testing/pipeline_recorder_utils_test.py | Anon-Artist/tfx | 2 | 23935 | <filename>tfx/experimental/pipeline_testing/pipeline_recorder_utils_test.py
# Lint as: python3
# Copyright 2020 Google LLC. 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 a... | 2.09375 | 2 |
tests/test1.py | pedroramaciotti/Cloudtropy | 0 | 23936 | import numpy as np
import matplotlib.pyplot as plt
from mpl_toolkits import mplot3d
# from scipy.stats import entropy
import sys
sys.path.append('../')
import cloudtropy
# data
gen_dim = 2
gen_N = 300
lims = (-2,6)
scale = 0.2
X = np.random.uniform(low=lims[0],high=lims[1],size=(10000,2)) # background
X = np.co... | 2.4375 | 2 |
uncertainty_wizard/models/ensemble_utils/_callables.py | p1ndsvin/uncertainty-wizard | 33 | 23937 | <reponame>p1ndsvin/uncertainty-wizard<filename>uncertainty_wizard/models/ensemble_utils/_callables.py<gh_stars>10-100
import gc
from dataclasses import dataclass
from typing import Dict, Tuple, Union
import numpy as np
import tensorflow as tf
@dataclass
class DataLoadedPredictor:
"""
The default task to be e... | 2.3125 | 2 |
venv/Lib/site-packages/PyQt4/examples/designer/calculatorform/ui_calculatorform.py | prateekfxtd/ns_Startup | 1 | 23938 | <gh_stars>1-10
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'calculatorform.ui'
#
# Created: Mon Jan 23 13:21:45 2006
# by: PyQt4 UI code generator vsnapshot-20060120
#
# WARNING! All changes made in this file will be lost!
import sys
from PyQt4 import QtCore, QtGui
class Ui_Calc... | 1.640625 | 2 |
ggtools/gg/static_models.py | richannan/GGTOOLS | 22 | 23939 | <reponame>richannan/GGTOOLS
from os import path,makedirs
from urllib.request import urlretrieve
def static_download(model):
'''
Download static gravity modle from icgem.gfz-potsdam.de; if the file to be downloaded is already included in the download directory, the download is automatically skipped.
U... | 2.890625 | 3 |
Python/linprog/simplex.py | bashardudin/LinearPrograms | 22 | 23940 | #!/usr/bin/env python
# _*_ encoding: utf-8 _*_
"""simplex.py: Simplex algorithm with rational coefficients"""
import numpy as np
import fractions as frac
__author__ = "<NAME>"
__email__ = "<EMAIL>"
class RestrictedSimplex(object):
def __init__(self, leaving_index=None, entering_index=None):
if not le... | 3.578125 | 4 |
openverse_catalog/dags/common/loader/smithsonian_unit_codes.py | yavik-kapadia/openverse-catalog | 25 | 23941 | """
This program helps identify smithsonian unit codes which are not yet added to
the smithsonian sub-provider dictionary
"""
import logging
from textwrap import dedent
import requests
from airflow.providers.postgres.hooks.postgres import PostgresHook
from common.loader import provider_details as prov
from providers.... | 2.3125 | 2 |
tests/programs/misc/causality_1.py | astraldawn/pylps | 1 | 23942 | <filename>tests/programs/misc/causality_1.py
from pylps.core import *
initialise(max_time=2)
create_fluents('test(_, _)')
create_actions('hello(_, _)')
create_variables('Person', 'Years', 'NewYears', 'OldYears',)
initially(test('A', 0),)
reactive_rule(True).then(
hello('A', 5),
)
hello(Person, Years).initiate... | 2.140625 | 2 |
gdrivefs-0.14.9-py3.6.egg/gdrivefs/utility.py | EnjoyLifeFund/macHighSierra-py36-pkgs | 0 | 23943 | import logging
import json
import re
import sys
import gdrivefs.conf
_logger = logging.getLogger(__name__)
# TODO(dustin): Make these individual functions.
class _DriveUtility(object):
"""General utility functions loosely related to GD."""
# # Mime-types to translate to, if they appear within the "exportLi... | 2.4375 | 2 |
RecoLocalCalo/HGCalRecProducers/python/HeterogeneousHEBRecHitGPUtoSoA_cfi.py | Purva-Chaudhari/cmssw | 852 | 23944 | import FWCore.ParameterSet.Config as cms
HEBRecHitGPUtoSoAProd = cms.EDProducer('HEBRecHitGPUtoSoA',
HEBRecHitGPUTok = cms.InputTag('HEBRecHitGPUProd'))
| 1.21875 | 1 |
net/data_formatter.py | lhq1/legal-predicetion | 0 | 23945 | <reponame>lhq1/legal-predicetion<filename>net/data_formatter.py
import os
import json
import torch
import random
import numpy as np
from net.loader import accusation_dict, accusation_list, law_dict, law_list
from net.loader import get_num_classes
def check_crit(data):
cnt = 0
for x in data:
if x in a... | 2.40625 | 2 |
doc/programming/parts/python-columninfo.py | laigor/sqlrelay-non-english-fixes- | 16 | 23946 | <filename>doc/programming/parts/python-columninfo.py
from SQLRelay import PySQLRClient
con=PySQLRClient.sqlrconnection('sqlrserver',9000,'/tmp/example.socket','user','password',0,1)
cur=PySQLRClient.sqlrcursor(con)
cur.sendQuery('select * from my_table')
con.endSession()
for i in range(0,cur.colCount()-1):
p... | 2.84375 | 3 |
showdownai/naive_bayes.py | AM22/Pokemon-AI | 0 | 23947 | <gh_stars>0
import json
from data import MOVE_CORRECTIONS, correct_mega
def get_moves(poke, known_moves, graph, data, alpha=1.0):
poke = correct_mega(poke)
co = graph['cooccurences']
freq = graph['frequencies']
probs = {}
if len(known_moves) == 0:
probs = get_freqs(poke, freq)
else:
... | 2.421875 | 2 |
AppDB/appscale/datastore/fdb/transactions.py | obino/appscale | 1 | 23948 | <gh_stars>1-10
"""
This module stores and retrieves datastore transaction metadata. The
TransactionManager is the main interface that clients can use to interact with
the transaction layer. See its documentation for implementation details.
"""
from __future__ import division
import logging
import math
import random
im... | 2.09375 | 2 |
Line_chart.py | sanabasangare/data-visualization | 0 | 23949 | import matplotlib.pyplot as plt
from collections import Counter
def line_graph(plt):
# years observed since 2000
years = [2000, 2002, 2005, 2007, 2010, 2012, 2014, 2015]
# total number of websites on the world wide web
# (source: Internet Live Stats)
websites = [17, 38, 64, 121, 206, 697, 968, 8... | 4.21875 | 4 |
miyamoto/test/mocks.py | caedesvvv/miyamoto | 1 | 23950 | from twisted.web import server, resource
class MockSubscriber(resource.Resource):
isLeaf = True
def render_GET(self, request):
if request.path.endswith('/callback'):
return request.args.get('hub.challenge', [''])[0]
else:
return "Huh?"
class MockPublisher(... | 2.40625 | 2 |
covid19/data.py | edupenabad/covid-19-notebooks | 0 | 23951 | <filename>covid19/data.py
import pathlib
import numpy as np
import pandas as pd
import requests
DATA_REPOS = {
"world": {
"url": "https://raw.githubusercontent.com/CSSEGISandData/COVID-19/master",
"streams": {
"deaths": "{url}/csse_covid_19_data/csse_covid_19_time_series/time_series_1... | 3.109375 | 3 |
util/utils.py | choyoungjung/xray-align-AR | 0 | 23952 | <reponame>choyoungjung/xray-align-AR
from __future__ import print_function
import random
from torch.autograd import Variable
import torch
from PIL import Image
import numpy as np
import math
import os
import cv2
'''
Code from
https://github.com/ycszen/pytorch-seg/blob/master/transform.py
Modified so it ... | 2.359375 | 2 |
pythonx/lints/vim/vint.py | maralla/validator.vim | 255 | 23953 | <reponame>maralla/validator.vim
# -*- coding: utf-8 -*-
from validator import Validator
class VimVint(Validator):
__filetype__ = 'vim'
checker = 'vint'
args = '-w --no-color'
regex = r"""
.+?:
(?P<lnum>\d+):
(?P<col>\d+):
\s(?P<text>.+)"""
| 2.421875 | 2 |
src/graph2.py | gpu0/nnGraph | 0 | 23954 | # t = 2 * (x*y + max(z,w))
class Num:
def __init__(self, val):
self.val = val
def forward(self):
return self.val
def backward(self, val):
print val
class Mul:
def __init__(self, left, right):
self.left = left
self.right = right
def forward(self):
sel... | 3.609375 | 4 |
skeleton_video.py | ashish1sasmal/Human-Skeleton-Estimation | 0 | 23955 | <reponame>ashish1sasmal/Human-Skeleton-Estimation<filename>skeleton_video.py
# @Author: <NAME> <ashish>
# @Date: 20-10-2020
# @Last modified by: ashish
# @Last modified time: 20-10-2020
import cv2
import numpy as np
import time
proto = "Models/pose_deploy_linevec_faster_4_stages.prototxt"
weights= "Models/pose_it... | 2.28125 | 2 |
temboo/core/Library/LittleSis/Relationship/GetOneRelationship.py | jordanemedlock/psychtruths | 7 | 23956 | <reponame>jordanemedlock/psychtruths
# -*- coding: utf-8 -*-
###############################################################################
#
# GetOneRelationship
# Retrieves information about any known relationship between two entities in LittleSis according their IDs.
#
# Python versions 2.6, 2.7, 3.x
#
# Copyright... | 2.21875 | 2 |
rec_to_nwb/test/processing/tools/test_beartype.py | jihyunbak/rec_to_nwb | 8 | 23957 | <reponame>jihyunbak/rec_to_nwb
#!/usr/bin/env python3
"""
`py.test`-driven unit test suite for the `@beartype` decorator, implementing a
rudimentary subset of PEP 484-style type checking based on Python 3.x function
annotations.
Usage
----------
These tests assume the `@beartype` decorator and all utility functions (... | 2.828125 | 3 |
var/spack/repos/builtin/packages/jemalloc/package.py | ilagunap/spack | 2 | 23958 | # Copyright 2013-2021 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class Jemalloc(AutotoolsPackage):
"""jemalloc is a general purpose malloc(3) implementation that... | 1.484375 | 1 |
ABC/abc051-abc100/abc093/b.py | KATO-Hiro/AtCoder | 2 | 23959 | <reponame>KATO-Hiro/AtCoder<filename>ABC/abc051-abc100/abc093/b.py
'''input
4 8 3
4
5
6
7
8
3 8 2
3
4
7
8
2 9 100
2
3
4
5
6
7
8
9
'''
# -*- coding: utf-8 -*-
# AtCoder Beginner Contest
# Problem B
if __name__ == '__main__':
a, b, k = list(map(int, input().split()))
if ... | 3.046875 | 3 |
examples/python/qiskit_integration.py | CQCL/pytket | 249 | 23960 | <reponame>CQCL/pytket
# # Integrating `pytket` into Qiskit software
# In this tutorial, we will focus on:
# - Using `pytket` for compilation or providing devices/simulators within Qiskit workflows;
# - Adapting Qiskit code to use `pytket` directly.
# This example assumes some familiarity with the Qiskit algorithms li... | 2.25 | 2 |
Cura/Cura/plugins/VersionUpgrade/VersionUpgrade34to35/__init__.py | TIAO-JI-FU/3d-printing-with-moveo-1 | 0 | 23961 | <filename>Cura/Cura/plugins/VersionUpgrade/VersionUpgrade34to35/__init__.py
# Copyright (c) 2018 <NAME>.
# Cura is released under the terms of the LGPLv3 or higher.
from typing import Any, Dict, TYPE_CHECKING
from . import VersionUpgrade34to35
if TYPE_CHECKING:
from UM.Application import Application
upgrade = V... | 2.140625 | 2 |
xos/synchronizer/pull_steps/test_pull_olts.py | iecedge/olt-service | 0 | 23962 | # Copyright 2017-present Open Networking Foundation
#
# 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 agr... | 1.773438 | 2 |
src/embedding/triple2vec.py | MengtingWan/grocery | 46 | 23963 | <filename>src/embedding/triple2vec.py
import tensorflow as tf
from embedding.learner import Model
from embedding.sampler import Sampler
import sys
class triple2vec(Model):
def __init__(self, DATA_NAME, HIDDEN_DIM, LEARNING_RATE, BATCH_SIZE, N_NEG, MAX_EPOCH=500, N_SAMPLE_PER_EPOCH=None):
super().__ini... | 2.734375 | 3 |
src/model/synapses/numba_backend/VoltageJump.py | Fassial/pku-intern | 0 | 23964 | <gh_stars>0
"""
Created on 12:39, June. 4th, 2021
Author: fassial
Filename: VoltageJump.py
"""
import brainpy as bp
__all__ = [
"VoltageJump",
]
class VoltageJump(bp.TwoEndConn):
target_backend = ['numpy', 'numba', 'numba-parallel', 'numba-cuda']
def __init__(self, pre, post, conn,
weight = 1., d... | 2.25 | 2 |
bns.py | amansrivastava17/bns-short-text-similarity | 22 | 23965 | <filename>bns.py
# coding=utf-8
from collections import Counter, namedtuple
from scipy.sparse import csr_matrix
from scipy.stats import norm
import numpy as np
import math
from nlp_utils import ngrams
class BNS:
"""Bi-normal Separation is a popular method to score textual data importance against its
belongi... | 3.359375 | 3 |
scrape.py | ilemhadri/fb_messenger | 11 | 23966 | import os
import sys
from collections import defaultdict
import datetime
import pickle
import re
import time
import json
from selenium import webdriver
def main():
driver = webdriver.Chrome() # Optional argument, if not specified will search path.
#load login cookie
driver.get('https://www.messenger.com')
... | 2.5625 | 3 |
cfgs/config.py | Pandinosaurus/yolo2-pytorch | 1,663 | 23967 | <gh_stars>1000+
import os
from .config_voc import * # noqa
from .exps.darknet19_exp1 import * # noqa
def mkdir(path, max_depth=3):
parent, child = os.path.split(path)
if not os.path.exists(parent) and max_depth > 1:
mkdir(parent, max_depth-1)
if not os.path.exists(path):
os.mkdir(path)
... | 1.734375 | 2 |
tests.py | jpchiodini/Grasp-Planning | 0 | 23968 | <filename>tests.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
tests.py
========
Created by: hbldh <<EMAIL>>
Created on: 2016-02-07, 23:50
"""
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
from __future__ import absolute_import
import numpy as np... | 2.15625 | 2 |
scripts/wsi_bot_show_regions.py | higex/qpath | 6 | 23969 | <reponame>higex/qpath<filename>scripts/wsi_bot_show_regions.py
# -*- coding: utf-8 -*-
"""
SHOW_REGIONS
Emphasizes some regions in the image, by decreasing the importance of the rest.
@author: vlad
"""
from __future__ import (absolute_import, division, print_function, unicode_literals)
from builtins import *
import... | 2.40625 | 2 |
isomyr/tests/test_thing.py | dave-leblanc/isomyr | 0 | 23970 | <reponame>dave-leblanc/isomyr<gh_stars>0
from unittest import TestCase
from isomyr.thing import Thing
from isomyr.world.world import Scene
class ThingOfThingsRemoveObjectTestCase(TestCase):
def setUp(self):
self.scene = Scene(0)
self.scene.addObject(Thing(name="apple"))
self.scene.addObj... | 3.140625 | 3 |
python/consecutive-characters.py | alirezaghey/leetcode-solutions | 3 | 23971 | <gh_stars>1-10
from itertools import groupby
class Solution:
def maxPower(self, s: str) -> int:
return max(len(list(g)) for _, g in groupby(s))
def maxPower2(self, s: str) -> int:
best, curr_count, curr_char = 1, 1, s[0]
for i in range(1, len(s)):
if s[i] =... | 3.046875 | 3 |
DigitalMeLib/servers/gedis/GedisProcessManager.py | jdelrue/digital_me | 0 | 23972 | <reponame>jdelrue/digital_me
from jumpscale import j
JSBASE = j.application.jsbase_get_class()
class GedisProcessManager(JSBASE):
pass
| 1.070313 | 1 |
lifesaver/bot/exts/health.py | lun-4/lifesaver | 12 | 23973 | # encoding: utf-8
import asyncio
import logging
import random
from typing import Optional, Tuple
import discord
from discord.ext import commands
import lifesaver
from lifesaver.utils.formatting import truncate
from lifesaver.utils.timing import Timer, format_seconds
log = logging.getLogger(__name__)
SendVerdict = T... | 2.203125 | 2 |
install/install.py | naztronaut/FCW | 4 | 23974 | <reponame>naztronaut/FCW
# install.py
# Version: 1.0.0
# Installs dependencies needed for FCW
# Author: <NAME>
# Website: https://www.easyprogramming.net
import os
from shutil import copy2
def install_dependencies():
print("================== Start Installing PIP and venv ==================")
os.system("sudo... | 2.296875 | 2 |
convert-to-loom/convert-to-loom-3.py | mzager/dv-pipelines | 3 | 23975 | #!/bin/python3
import sys
import os
import pandas as pd
import scanpy as sc
import anndata
from anndata import AnnData
sc.settings.verbosity = 3 # verbosity: errors (0), warnings (1), info (2), hints (3)
working_dir = os.getcwd()
adata = sc.read(os.path.join(working_dir, 'gene_count.txt'),
cache=Tru... | 2.859375 | 3 |
venv/lib/python3.8/site-packages/poetry/core/_vendor/lark/parsers/earley_forest.py | Retraces/UkraineBot | 2 | 23976 | <filename>venv/lib/python3.8/site-packages/poetry/core/_vendor/lark/parsers/earley_forest.py
/home/runner/.cache/pip/pool/8f/d6/74/783ee5c7dc6070d67f88eab5cd5dae217fdec6556b8d97a3bd1061e541 | 1.085938 | 1 |
schedsi/threads/_bg_stat_thread.py | z33ky/schedsi | 1 | 23977 | <gh_stars>1-10
"""Define the :class:`_BGStatThread`.
This should be used in favor of :class:`Thread` for non-worker threads.
"""
from schedsi.threads.thread import Thread, LOG_INDIVIDUAL
import sys
class _BGStatThread(Thread):
"""Base class for threads recording background time."""
def __init__(self, modul... | 2.4375 | 2 |
069_totient_maximum.py | fbcom/project-euler | 0 | 23978 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# A Solution to "Totient maximum" – Project Euler Problem No. 69
# by <NAME>
#
# Sourcecode: https://github.com/fbcom/project-euler
# Problem statement: https://projecteuler.net/problem=69
def is_prime(n):
if n < 2:
return False
if n == 2:
return... | 3.546875 | 4 |
lectures/07-python-dictionaries/examples/gashlycrumb.py | mattmiller899/biosys-analytics | 4 | 23979 | <gh_stars>1-10
#!/usr/bin/env python3
"""dictionary lookup"""
import os
import sys
args = sys.argv[1:]
if len(args) != 1:
print('Usage: {} LETTER'.format(os.path.basename(sys.argv[0])))
sys.exit(1)
letter = args[0].upper()
lines = """
A is for Amy who fell down the stairs.
B is for Basil assaulted by bears... | 3.140625 | 3 |
to_nwb/extensions/buzsaki_meta/buzsaki_meta.py | mpompolas/to_nwb | 1 | 23980 | <filename>to_nwb/extensions/buzsaki_meta/buzsaki_meta.py
from pynwb import load_namespaces
from ..auto_class import get_class, get_multi_container
# load custom classes
namespace = 'buzsaki_meta'
ns_path = namespace + '.namespace.yaml'
ext_source = namespace + '.extensions.yaml'
load_namespaces(ns_path)
BuzSubject =... | 2.0625 | 2 |
tests/search_test.py | krishna-kalavadia/computer-vision-python | 9 | 23981 | <filename>tests/search_test.py
from modules.search.Search import Search
from modules.search.searchWorker import searchWorker
mock_tent = {
"latitude": 51.083665,
"longitude": -114.114693
}
mock_plane = {
"latitude": 51.059971,
"longitude": -114.10714
}
def test_search_function():
search = Search(... | 2.609375 | 3 |
Lesson 12 Keras/Test_Keras.py | alchemz/Self-Driving-Car-Engineer-Nanodegree | 1 | 23982 | <reponame>alchemz/Self-Driving-Car-Engineer-Nanodegree<gh_stars>1-10
# Load pickled data
import pickle
import numpy as np
import tensorflow as tf
tf.python.control_flow_ops = tf
with open('small_train_traffic.p', mode='rb') as f:
data = pickle.load(f)
X_train, y_train = data['features'], data['labels']
# Initial... | 2.53125 | 3 |
crude/extrude_crude/take_05_model_run.py | i2mint/crude | 0 | 23983 | <filename>crude/extrude_crude/take_05_model_run.py<gh_stars>0
"""
Same as take_04_model_run, but where the dispatch is not as manual.
"""
from front.crude import KT, StoreName, Mall
from crude.extrude_crude.extrude_crude_util import mall, np, apply_model
# --------------------------------------------------------------... | 2.234375 | 2 |
tests/conftest.py | Anishmourya/flask-restx-api | 3 | 23984 | import pytest
from app import create_app
@pytest.fixture
def client():
app = create_app()
client = app.test_client()
return client
| 1.75 | 2 |
Part_3_advanced/m14_metaclass/register_cls/homework_1_solution/example_system/bike.py | Mikma03/InfoShareacademy_Python_Courses | 0 | 23985 | from example_system.serializable import RegisteredSerializable
class Bike(RegisteredSerializable):
def __init__(self, brand: str, model: str) -> None:
super().__init__(brand, model)
self.brand = brand
self.model = model
def __str__(self) -> str:
return f"Bike: {self.brand} {se... | 3.0625 | 3 |
authentication/authenticator.py | gabrielbazan/http_auth | 0 | 23986 |
class Authenticator(object):
def authenticate(self, credentials):
raise NotImplementedError()
| 2.296875 | 2 |
spatial_two_mics/data_loaders/wham.py | etzinis/unsupervised_spatial_dc | 21 | 23987 | <filename>spatial_two_mics/data_loaders/wham.py
"""!
@brief Pytorch dataloader for wham dataset for multiple gender combinations.
@author <NAME> {<EMAIL>}
@copyright University of illinois at Urbana Champaign
"""
import torch
import os
import numpy as np
import pickle
import glob2
import sys
current_dir = os.path.di... | 2.046875 | 2 |
dali/test/python/test_operator_input_promotion.py | lbhm/DALI | 1 | 23988 | <filename>dali/test/python/test_operator_input_promotion.py
# Copyright (c) 2020, NVIDIA CORPORATION. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.a... | 2.1875 | 2 |
www/transwarp/orm.py | houxiao2011/webapp-python | 0 | 23989 | <filename>www/transwarp/orm.py
#!/usr/bin/env python
# --*-- coding: utf-8 --*--
import time, logging
import db
class Field(object):
_count = 0
def __init__(self, **kw):
self.name = kw.get('name', None)
self._default = kw.get('default', None)
self.primary_key = kw.get('primary_key', ... | 2.453125 | 2 |
EX10 dolar carteira.py | RODRIGOKTK/Python-exercicios | 0 | 23990 | carteira=float(input('Quanto tem na carteira: '))
dolar=3.27
print('Equivalente em dolares: %.2f ' %(carteira/dolar))
| 3.890625 | 4 |
code/libs/utils.py | shinebobo/Semantic-Line-SLNet | 1 | 23991 | <reponame>shinebobo/Semantic-Line-SLNet
import os
import pickle
import numpy as np
import random
import torch
global global_seed
global_seed = 123
torch.manual_seed(global_seed)
torch.cuda.manual_seed(global_seed)
torch.cuda.manual_seed_all(global_seed)
np.random.seed(global_seed)
random.seed(global_seed)
def _init... | 2.15625 | 2 |
api/admin.py | Neoklosch/QuestionBasedServer | 0 | 23992 | from django.contrib import admin
from api.models import Answer, Question, User
from django import forms
class AnswerAdmin(admin.ModelAdmin):
model = Answer
class QuestionAdmin(admin.ModelAdmin):
model = Question
# class UserForm(forms.ModelForm):
# password = forms.CharField(widget=forms.PasswordInput... | 2.375 | 2 |
Minesweeper_Python/src/MyAI.py | Thomas1728/AI-MineSweeper | 0 | 23993 | <gh_stars>0
# ==============================CS-171==================================
# FILE: MyAI.py
#
# AUTHOR: bugMaker
#
# DESCRIPTION: This file contains the MyAI class. You will implement your
# agent in this file. You will write the 'getAction' function,
# the constructor, and any additional help... | 2.9375 | 3 |
BinaryTree/Node.py | Pedro29152/binary-search-tree-python | 0 | 23994 | <gh_stars>0
class Node():
def __init__(self, id: int, value = None, right: 'Node' = None, left: 'Node' = None):
self.id = id
self.value = value
self.right = right
self.left = left
self.parent: 'Node' = None
def add(self, node: 'Node'):
if not node:
... | 3.546875 | 4 |
src/moreos/parsing.py | sigmavirus24/moreos | 3 | 23995 | """Parsing utilities for moreos."""
import re
import attr
@attr.s(frozen=True)
class ABNF:
"""Container of regular expressions both raw and compiled for parsing."""
# From https://tools.ietf.org/html/rfc2616#section-2.2
ctl = control_characters = "\x7f\x00-\x1f"
digit = "0-9"
separators = r"\[\]... | 2.703125 | 3 |
tests/factorys.py | ireneontheway5/pymilvus | 0 | 23996 | # STL imports
import random
import logging
import string
import time
import datetime
import random
import struct
import sys
from functools import wraps
# Third party imports
import numpy as np
import faker
from faker.providers import BaseProvider
logging.getLogger('faker').setLevel(logging.ERROR)
sys.path.append('.'... | 2.3125 | 2 |
tests/test_resources/fixtures/py3_tokens.py | cbillingham/docconvert | 8 | 23997 | """Module docstring!"""
a = 1
b = 2
@bleh
@blah
def greet(
name: str,
age: int,
*args,
test='oh yeah',
**kwargs
) -> ({a: 1, b: 2}
):
"""Generic short description
Longer description of this function that does nothing
:param arg1: Desc for arg1
:type arg1: arg1_type
:r... | 3.3125 | 3 |
src/editor/selection.py | rehmanx/PandaEditor | 0 | 23998 | <filename>src/editor/selection.py
import panda3d.core as pm
from editor.p3d.object import Object
from editor.p3d.marquee import Marquee
from editor.p3d.mousePicker import MousePicker
from editor.constants import TAG_IGNORE, TAG_PICKABLE
class Selection(Object):
BBOX_TAG = 'bbox'
def __init__(self, *args, **k... | 2.875 | 3 |
cinder/tests/unit/policies/test_volume.py | arunvinodqmco/cinder | 571 | 23999 | <gh_stars>100-1000
#
# 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 in wri... | 1.710938 | 2 |