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 |
|---|---|---|---|---|---|---|
tests/test_generator.py | thombashi/elasticsearch-faker | 1 | 12789651 | import json
import sys
from textwrap import dedent
import pytest
from faker import Factory, Faker
from elasticsearch_faker._generator import FakeDocGenerator
from elasticsearch_faker._provider import re_provider
class TestFakeDocGenerator:
@pytest.mark.skipif(sys.version_info < (3, 6), reason="requires python3.... | 2.1875 | 2 |
server/edd/load/exceptions/parse.py | trussworks/edd | 13 | 12789652 | <filename>server/edd/load/exceptions/parse.py
from django.utils.translation import gettext_lazy as _
from .core import EDDImportError, EDDImportWarning
class ParseError(EDDImportError):
pass
class ParseWarning(EDDImportWarning):
pass
class BadParserError(ParseError):
def __init__(self, **kwargs):
... | 2.171875 | 2 |
pycordia/events.py | classPythonAddike/pycordia | 23 | 12789653 | import typing
from datetime import datetime
from .models import Member, User, Message
from . import utils
class ReadyEvent:
"""
Event called when the client is ready.
Attributes:
gateway_version (int): The version used for the WebSockets gateway
user (User): The bot using the gateway
... | 2.453125 | 2 |
ticker/widgets.py | jezdez/django-ticker | 1 | 12789654 | <gh_stars>1-10
from django.utils.safestring import mark_safe
from django import forms
class ForeignKeyAsTextWidget(forms.HiddenInput):
def __init__(self, append_text, *args, **kwargs):
self.append_text = append_text
super(ForeignKeyAsTextWidget, self).__init__()
def render(self, *args, **kwar... | 2.1875 | 2 |
eres/events/GpioEvent.py | Tharnas/rc-eres-speaker | 0 | 12789655 | from .Event import Event
class GpioEvent(Event):
def __init__(self, origin, message):
super().__init__('Gpio')
self.origin = origin
self.message = message
def __str__(self):
return self.origin + ': ' + self.message
@property
def origin(self):
... | 2.875 | 3 |
webdriver_manager/__init__.py | fictitiouswizard/webdriver_manager | 0 | 12789656 | __version__ = '3.4.1'
from .chrome import ChromeDriverManager
from .firefox import GeckoDriverManager
from .microsoft import EdgeChromiumDriverManager, IEDriverManager
from .opera import OperaDriverManager
| 1.1875 | 1 |
FoF/analysis/mass_estimator.py | kennethcheo/FoF | 1 | 12789657 | <reponame>kennethcheo/FoF<gh_stars>1-10
#!/usr/bin/env python3
import itertools
import numpy as np
import matplotlib.pyplot as plt
from astropy import units as u
import astropy.constants as const
from astropy.coordinates import SkyCoord
from astropy.cosmology import LambdaCDM
from astropy.stats import bootstrap
from... | 2.59375 | 3 |
popgen/utils/__init__.py | linzwatt/PopGen | 58 | 12789658 | from .sigmoid_annealing import sigmoid_annealing
| 1.117188 | 1 |
src/briefcase/platforms/macOS/__init__.py | probonopd/briefcase | 0 | 12789659 | <gh_stars>0
DEFAULT_OUTPUT_FORMAT = 'dmg'
class macOSMixin:
platform = 'macOS'
def verify_tools(self):
pass
| 1.351563 | 1 |
problems/knapsack/params/buildEssenceParams.py | conjure-cp/EssenceCatalog | 6 | 12789660 | <gh_stars>1-10
#!/usr/bin/env python3
import sys
def assertStartsWith(prefix,line):
if not line.startswith(prefix):
print("Error: Expected line to start with " + prefix +
".\nLine: " + line, file=sys.stderr)
sys.exit(1)
def readValue(prefix, file):
line = file.readline()
assertSta... | 3.265625 | 3 |
gui/viz_pygame.py | clinfo/DeepKF | 5 | 12789661 | # coding: utf-8
#
import numpy as np
import json
from socket import *
import select
import pygame
from pygame.locals import *
import sys
HOST = gethostname()
PORT = 1113
BUFSIZE = 1024
ADDR = ("127.0.0.1", PORT)
USER = 'Server'
INTERVAL=0.01
VEROCITY=100
LIFETIME=1000
#Window.fullscreen=True
class DataReceiver:
d... | 2.703125 | 3 |
ls/lslocal.py | nanqinlang/lightsocks-minami | 15 | 12789662 | import argparse
import asyncio
import sys
sys.path.append("..")
from module.password import InvalidPasswordError, loadsPassword
from utils import net
from core.local import LsLocal
from utils import config as lsConfig
def run_server(config: lsConfig.Config):
loop = asyncio.get_event_loop()
... | 2.265625 | 2 |
casino/utils.py | Nerf-Bot/NerfCogs | 0 | 12789663 | <reponame>Nerf-Bot/NerfCogs
import re
import math
from typing import Union, Dict, List, Sequence
utf8_re = re.compile(r"^[\U00000000-\U0010FFFF]*$")
min_int, max_int = 1 - (2 ** 64), (2 ** 64) - 1
def is_input_unsupported(data: Union[Dict, List, str, int, float]):
if type(data) is dict:
for k, v in data... | 3.3125 | 3 |
generator.py | Amitdedhia6/DrugDiscovery | 0 | 12789664 | <filename>generator.py
import torch
from torch import nn
from common import device, max_sequence_length, noise_vector_length, noise
class Generator(torch.nn.Module):
"""
A generative neural network
"""
def __init__(self, vocab):
super(Generator, self).__init__()
self.vocab = vocab
... | 2.84375 | 3 |
src/t4me/bandstructure.py | knirajiitb/t4me_AMMCR | 6 | 12789665 | <filename>src/t4me/bandstructure.py
# Copyright 2016 <NAME>
#
# This file is part of T4ME and covered by the BSD 3-clause license.
#
# You should have received a copy of the BSD 3-clause license
# along with T4ME. If not, see <https://opensource.org/licenses/BSD-3-Clause/>.
#!/usr/bin/python
"""Contains rout... | 1.976563 | 2 |
spyke/enums/other.py | m4reQ/spyke | 0 | 12789666 | import enum
class CameraType(enum.Enum):
Orthographic = enum.auto()
Perspective = enum.auto()
class Vendor(enum.Enum):
Nvidia = enum.auto()
Intel = enum.auto()
Amd = enum.auto()
WindowsSoftware = enum.auto()
Unknown = enum.auto() | 2.328125 | 2 |
src/ops/python/rec_dataset.py | lonway/poeem | 38 | 12789667 | <reponame>lonway/poeem<filename>src/ops/python/rec_dataset.py
import tensorflow as tf
from tensorflow.python.framework import ops
from tensorflow.python.data.ops import dataset_ops
from tensorflow.python.framework import dtypes
from poeem.ops.bin import rec_dataset_op
class RecDataset(dataset_ops.Dataset):
def _a... | 2.203125 | 2 |
unlockgnn/datalib/mining.py | CalvinCYY/unlockGNN | 0 | 12789668 | """Tools to scrape relevant compound data from Materials Project and label their ions' SSEs appropriately."""
from multiprocessing import Pool
from operator import itemgetter
from pathlib import Path
from typing import Optional, Tuple, Union
import pandas as pd
import pyarrow.feather as feather
import pymatgen
import ... | 2.6875 | 3 |
discord/ext/ui/message.py | sushi-chaaaan/discord-ext-ui-fork | 27 | 12789669 | from __future__ import annotations
from typing import Union
import discord
from discord import ui
from .item import Item
class Message:
def __init__(
self,
content: str = "",
embeds: list[discord.Embed] = None,
components: list[Union[list[Item], Item]] = None):
... | 2.8125 | 3 |
biometrics/sex_mismatch.py | msk-access/biometrics | 1 | 12789670 | import pandas as pd
import numpy as np
class SexMismatch:
"""
Class to detect sex mismatch
"""
def __init__(self, threshold):
self.threshold = threshold
def predict_sex(self, sample):
if sample.region_counts is None:
return np.nan
total_count = sample.region... | 3.0625 | 3 |
bin/calculate_dataset_metrics.py | samsungnlp/semeval2022-task9 | 0 | 12789671 | #!/usr/bin/env python
import pprint
from src.data_question_class_statistics import QuestionClassStatistics
from src.data_statistics import PassageStatsCalculator, QuestionsAnswersMinMaxAvgStats
from src.data_statistics_closed_set_answers import ClosedSetAnswerChecker
from src.data_statistics_extractive_answer import E... | 2.15625 | 2 |
Python/other/sudoku_backtracking.py | zhcet19/NeoAlgo-1 | 897 | 12789672 | <filename>Python/other/sudoku_backtracking.py
def solve(board, i=0, j=0):
i,j = nextCell(board, i, j)
if i == -1:
return True
for e in range(1,10):
if isValid(board,i,j,e):
board[i][j] = e
if solve(board, i, j):
... | 4.25 | 4 |
Model_setup/NEISO_exchange_time_series.py | keremakdemir/ISONE_UCED | 0 | 12789673 | # -*- coding: utf-8 -*-
"""
Created on Mon May 14 17:29:16 2018
@author: jdkern
"""
from __future__ import division
import pandas as pd
import numpy as np
def exchange(year):
df_data = pd.read_csv('../Time_series_data/Synthetic_demand_pathflows/Sim_daily_interchange.csv',header=0)
paths = ['SALBRYNB', 'ROSET... | 2.4375 | 2 |
exact_string_matching/backward.py | pmikolajczyk41/string-algorithms | 0 | 12789674 | <gh_stars>0
from common import suffix
def brute_force(t, w, n, m):
i = 1
while i <= n - m + 1:
j = m
while j > 0 and t[i + j - 1] == w[j]:
j = j - 1
if j == 0:
yield i
i = i + 1
def weak_boyer_moore(t, w, n, m):
wBM = suffix.weak_boyer_moore_shift(w, m)
i = 1
while i <= n - m + 1... | 2.484375 | 2 |
tests/test_contact.py | rehanalam1/python-o365 | 0 | 12789675 | from O365 import contact
import unittest
import json
import time
class Resp:
def __init__(self,json_string,code=None):
self.jsons = json_string
self.status_code = code
def json(self):
return json.loads(self.jsons)
contact_rep = open('contacts.json','r').read()
contacts_json = json.loads(contact_rep)
jeb = c... | 2.375 | 2 |
tests/test_generators.py | smartlegionlab/smartpassgen | 2 | 12789676 | # -*- coding: utf-8 -*-
# --------------------------------------------------------
# Licensed under the terms of the BSD 3-Clause License
# (see LICENSE for details).
# Copyright © 2018-2021, <NAME>
# All rights reserved.
# --------------------------------------------------------
# https://github.com/smartlegionlab
# <... | 2.40625 | 2 |
Examenes/Parcial/Pregunta_4.py | MrAngelwwev2/CC411-Seguridad-en-sistemas-informaticos | 0 | 12789677 | <reponame>MrAngelwwev2/CC411-Seguridad-en-sistemas-informaticos
#El siguiente programa en Python consiste en conocer la MAC tanto de la victima como del router
#Realizamos las importaciones necesarias
import os
import time
import sys
from scapy.all import *
from scapy.layers.inet import *
def obtenerInformacio... | 3.078125 | 3 |
util.py | sharpvik/fin | 0 | 12789678 | import numpy as np
import pandas as pd
def sma(price: np.ndarray, period: int) -> np.ndarray:
return price.rolling(period).mean()
| 2.828125 | 3 |
pylox/lox_errors.py | BolunThompson/PyLox | 2 | 12789679 | from __future__ import annotations
import enum
import inspect
import sys
import typing as tp
import pylox.misc_utils as mu
import pylox.token_classes as tc
DEFAULT_ERROR = "Something very wrong has happened"
ErrorLine = tp.Union[int, str]
class ReturnsNT(tp.NamedTuple):
code: int
type: str
class ErrorRe... | 2.53125 | 3 |
month01/all_code/day07/exercise06.py | chaofan-zheng/tedu-python-demo | 4 | 12789680 | <filename>month01/all_code/day07/exercise06.py
"""
练习1:请排列出两个色子可以组成的所有可能(列表)
练习2:请排列出三个色子可以组成的所有可能(列表)
色子1~6 range(1,7)
色子1~6 range(1,7)
"""
# list_result = []
# for x in range(1,7):
# for y in range(1,7):
# list_result.append((x,y))
# list_result = [(x, y) for x in range(1, 7) for y in ra... | 3.8125 | 4 |
src/wai/annotations/core/stream/__init__.py | waikato-ufdl/wai-annotations-core | 0 | 12789681 | """
Package for base stream-processing classes.
"""
from ._Pipeline import Pipeline
from ._StreamProcessor import StreamProcessor, InputElementType, OutputElementType
from ._StreamSink import StreamSink
from ._StreamSource import StreamSource
from ._typing import ThenFunction, DoneFunction, ElementType
| 1.242188 | 1 |
maine-rcv-code/v1-ballot-list-based/audit_me.py | Dovermore/2018-rcv-audits | 1 | 12789682 | <reponame>Dovermore/2018-rcv-audits
# audit_me.py
# <NAME>
# September 26, 2018
"""
Code to simulate auditing of ME RCV contest.
"""
from consistent_sampler import sampler
import hashlib
import rcv
hash_count = 0
def randint(a, b):
"""
Return pseudorandom between a (inclusive) and b (exclusive)
"""
... | 2.6875 | 3 |
Problems_1_to_100/Problem_21/problem_21.py | ikostan/ProjectEuler | 1 | 12789683 | #!/usr/bin/python
import time
from utils.utils import print_time_log
def sum_of_proper_divisors(number: int):
"""
Let d(n) be defined as the sum of proper divisors of n
(numbers less than n which divide evenly into n).
:param number:
:return:
"""
divisors = []
for n in range(1, numbe... | 3.90625 | 4 |
resumes/migrations/0005_contactdetails_address_2.py | USUDR2604/Django-ResumeBuilder | 0 | 12789684 | # Generated by Django 3.2.5 on 2021-07-12 05:10
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('resumes', '0004_remove_contactdetails_address_2'),
]
operations = [
migrations.AddField(
model_name='contactdetails',
... | 1.679688 | 2 |
tests/test_neoschema_data_import.py | BrainAnnex/brain-annex | 0 | 12789685 | <reponame>BrainAnnex/brain-annex
# Testing of Schema-based Data Import
# *** CAUTION! *** The database gets cleared out during some of the tests!
# NOTES: - some tests require APOC
# - some tests may fail their date check if done close to midnight, server time
import pytest
from BrainAnnex.modules.neo_access ... | 2.234375 | 2 |
rl/agents/ddpg.py | KNakane/tensorflow | 1 | 12789686 | # -*- coding: utf-8 -*-
import os,sys
sys.path.append(os.path.join(os.path.dirname(__file__), '../../utility'))
sys.path.append(os.path.join(os.path.dirname(__file__), '../../network'))
import numpy as np
import tensorflow as tf
from agent import Agent
from eager_nn import ActorNet, CriticNet
from optimizer import *
fr... | 2.125 | 2 |
src/OnewheelHudVideo.py | wmaciel/video-hud | 5 | 12789687 | # -*- coding: utf-8 -*-
from datetime import timedelta
import tqdm
from moviepy.editor import *
from IconManager import IconManager
import LogParser
resolution_map = {
'1080': {
'portrait': {'w': 1080, 'h': 1920},
'landscape': {'w': 1920, 'h': 1080}
},
'720': {
'portrait': {'w': 720... | 2.359375 | 2 |
tests/gravity_support_objects_test.py | NextCenturyCorporation/mcs-scene-generator | 4 | 12789688 | from generator import (
DefinitionDataset,
ObjectDefinition,
gravity_support_objects,
)
def test_getters_reuse_immutable_dataset():
dataset_1 = (
gravity_support_objects.get_symmetric_target_definition_dataset(
unshuffled=True
)
)
dataset_2 = (
gravity_suppo... | 2.25 | 2 |
utils/utils.py | lovish1234/TPC | 0 | 12789689 | <gh_stars>0
# calculate average, confusion matrix, accruacy
import torch
import numpy as np
import os
import ntpath
import sys
from datetime import datetime
import glob
import matplotlib.pyplot as plt
plt.switch_backend('agg')
from collections import deque
from tqdm import tqdm
from torchvision import transforms
... | 2.109375 | 2 |
chat_match/__init__.py | Latiosu/chat-match | 0 | 12789690 | <gh_stars>0
__version__ = '0.1.0'
import firebase_admin
from firebase_admin import credentials, firestore
from flask import Flask
from flask_restful import Resource, Api, reqparse
from datetime import datetime, timezone
import random
import re
import string
import uuid
from uuid import UUID
# Use a service account
... | 2.640625 | 3 |
tests/test_summary.py | ChielWH/prometheus_redis_client | 19 | 12789691 | <reponame>ChielWH/prometheus_redis_client<filename>tests/test_summary.py
import re
from unittest.mock import patch
import pytest
from .helpers import MetricEnvironment
import prometheus_redis_client as prom
class TestSummary(object):
def test_interface_without_labels(self):
with MetricEnvironment() as ... | 2.140625 | 2 |
tests/context.py | rreben/zettelkasten_tools | 1 | 12789692 | <filename>tests/context.py<gh_stars>1-10
# context.py
import sys
import os
sys.path.insert(0, os.path.abspath(
os.path.join(os.path.dirname(__file__), '..')))
import tools4zettelkasten # noqa # pylint: disable=unused-import, wrong-import-position
| 1.421875 | 1 |
data_loader/cifar_data_loader.py | david-riser/cifar-deepcluster | 0 | 12789693 | <filename>data_loader/cifar_data_loader.py
from base.base_data_loader import BaseDataLoader
from utils.factory import create
from tensorflow.keras.datasets import cifar10
from tensorflow.keras.preprocessing.image import ImageDataGenerator
class CifarDataLoader(BaseDataLoader):
def __init__(self, config):
s... | 2.75 | 3 |
Chapter 08/ch8_36.py | bpbpublications/TEST-YOUR-SKILLS-IN-PYTHON-LANGUAGE | 0 | 12789694 | <filename>Chapter 08/ch8_36.py
nums1 = [1, 2, 3]
nums2 = [4, 5]
nums=[(x,y) for x in nums1 for y in nums2]
print(nums)
#[(1,4), (1,5), (2,4), (2,5), (3,4), (3,5)] | 3.78125 | 4 |
Par_Impar_Jogo.py | cafesao/Programas_Python | 1 | 12789695 | # Este programa funciona como um jogo de Par ou Impár, com varios if dentro de uma estrutura
# de repetição com uma flag
import random
j1 = c2 = re = pi = 0
lista1 = [2,4]
lista2 = [1,3,5]
lista3 = [1, 2, 3, 4, 5]
stop = ''
print('Este e a brincadeira do Par ou Impár!')
while True:
j1 = int(input('\nD... | 3.8125 | 4 |
opencv_test1/demo/7.py | 18970738669/opencv_demo | 1 | 12789696 | <filename>opencv_test1/demo/7.py
import cv2
import numpy as np
from matplotlib import pyplot as plt
img = cv2.imread('/home/python/Desktop/opencv_test/samoye1.jpg', 0)
ret, thresh1 = cv2.threshold(img, 127, 255, cv2.THRESH_BINARY)
ret, thresh2 = cv2.threshold(img, 127, 255, cv2.THRESH_BINARY_INV)
ret, thresh3 = cv2.th... | 2.890625 | 3 |
haas_lib_bundles/python/docs/examples/temperature_humidity/haas506/code/gxht30.py | wstong999/AliOS-Things | 0 | 12789697 | <reponame>wstong999/AliOS-Things
from driver import I2C
class GXHT30(object):
# init i2cDev
def __init__(self,i2cObj):
self.i2cObj=None
if not isinstance(i2cObj,I2C):
raise ValueError("parameter is not an I2C object")
self.i2cObj=i2cObj
# write cmd to register
... | 2.65625 | 3 |
src/augraphy/default/pipeline.py | faizan1041/augraphy | 0 | 12789698 | """The default recommended pipeline.
If you don't need to produce your own augmentations or specialized pipelines,
you can use this to generate more images.
"""
import random
from augraphy.base.paperfactory import PaperFactory
from augraphy.base.oneof import OneOf
from augraphy.base.augmentationsequence import Augmen... | 1.726563 | 2 |
demo/profiles/migrations/0001_initial.py | jdavidagudelo/django-userena-ce | 86 | 12789699 | # Generated by Django 3.0.5 on 2020-04-01 20:15
import django.db.models.deletion
import easy_thumbnails.fields
from django.conf import settings
from django.db import migrations, models
import userena.models
class Migration(migrations.Migration):
initial = True
dependencies = [
migrations.swappable_... | 1.789063 | 2 |
src/cashier/purchase/container.py | artdotlis/Cashier | 0 | 12789700 | <reponame>artdotlis/Cashier
# -*- coding: utf-8 -*-
"""A module providing global data containers."""
from dataclasses import dataclass
from decimal import Decimal
from typing import final
@final
@dataclass
class PurchasedItem:
"""A container describing the purchased item."""
imported: bool
"""Whether the... | 2.21875 | 2 |
kafkaapi.py | MarkWh1te/mysql2kafka | 1 | 12789701 | # -*- coding: utf-8 -*-
from kafka import KafkaProducer
class Kafka(object):
def __init__(self,servers,zookeeper=None):
self.zookeeper = zookeeper
self.producer = KafkaProducer(bootstrap_servers=servers)
def send(self,topic,data):
future = self.producer.send(
topic,
... | 2.5 | 2 |
penygader/plotting/publication.py | Cadair/penygader | 0 | 12789702 | <filename>penygader/plotting/publication.py<gh_stars>0
# -*- coding: utf-8 -*-
"""
Created on Mon Dec 3 16:24:02 2012
@author: <NAME>
This module imports matplotlib with customisations I use when creating
figures for inclusion in print publications.
Usage
-----
>>> from penygader.plotting.publication import *
>>>... | 2.59375 | 3 |
podpy/Spectrum.py | turnerm/podpy | 0 | 12789703 | <gh_stars>0
"""
podpy is an implementatin of the pixel optical depth method as described in
Turner et al. 2014, MNRAS, 445, 794, and Aguirre et al. 2002, ApJ, 576, 1.
Please contact the author (<NAME>) at <EMAIL> if you have
any questions, comment or issues.
"""
import numpy as np
import scipy.interpolate as intp
... | 2.65625 | 3 |
examples/vehicle.py | 20tab/pybulletphysics | 21 | 12789704 | <reponame>20tab/pybulletphysics
from bulletphysics import *
broadphase = DbvtBroadphase()
collisionConfiguration = DefaultCollisionConfiguration()
dispatcher = CollisionDispatcher(collisionConfiguration)
solver = SequentialImpulseConstraintSolver()
world = DiscreteDynamicsWorld(dispatcher, broadphase, solver,collis... | 2.453125 | 2 |
client/setup.py | lagudomeze/starwhale | 1 | 12789705 | <filename>client/setup.py
from setuptools import setup, find_packages
install_requires = open("requirements.txt").readlines()
setup(name='starwhale',
version="0.1.0",
description='MLOps Platform',
keywords="MLOps AI",
url='https://github.com/star-whale/starwhale',
license='Apache-2.0',
... | 1.375 | 1 |
metrics/kinetics/accuracy_metrics.py | cairensi/gesture-recognition | 1 | 12789706 | # Author by CRS-club and wizard
from __future__ import absolute_import
from __future__ import unicode_literals
from __future__ import print_function
from __future__ import division
import numpy as np
import datetime
import logging
logger = logging.getLogger(__name__)
class MetricsCalculator():
def __init__(sel... | 2.328125 | 2 |
tools/SDKTool/src/ui/tree/ai_tree/action_dqn_data.py | Passer-D/GameAISDK | 1,210 | 12789707 | <filename>tools/SDKTool/src/ui/tree/ai_tree/action_dqn_data.py
# -*- coding: utf-8 -*-
"""
Tencent is pleased to support the open source community by making GameAISDK available.
This source code file is licensed under the GNU General Public License Version 3.
For full details, please refer to the file "LICENSE.txt" wh... | 1.796875 | 2 |
app/grandchallenge/uploads/emails.py | kant/grand-challenge.org | 0 | 12789708 | from django.conf import settings
from grandchallenge.core.utils.email import send_templated_email
def send_file_uploaded_notification_email(**kwargs):
uploader = kwargs["uploader"]
challenge = kwargs["challenge"]
site = kwargs["site"]
title = f"[{challenge.short_name.lower()}] New Upload"
admins ... | 2.171875 | 2 |
ontquery/__init__.py | tmsincomb/ontquery | 1 | 12789709 | from ontquery.query import OntQuery, OntQueryCli
from ontquery.terms import OntCuries, OntId, OntTerm
from ontquery import plugin
__all__ = ['OntCuries', 'OntId', 'OntTerm', 'OntQuery', 'OntQueryCli']
__version__ = '0.2.8'
| 1.210938 | 1 |
raw/files_manager.py | atoms18/BMI-prediction-from-Human-Image | 3 | 12789710 |
import shutil
from os import listdir
from os.path import isfile, join
from pathlib import Path
outlier_files = {f for f in listdir("outlier") if isfile(join("outlier", f))}
raw_outlier_files = {Path(f).stem + ".jpg" for f in listdir("raw_outlier_datasets/") if isfile(join("raw_outlier_datasets/", f))}
move_files =... | 2.8125 | 3 |
problems/bubble-sort/bubble-sort.py | vidyadeepa/the-coding-interview | 1,571 | 12789711 | <reponame>vidyadeepa/the-coding-interview
def bubblesort(l):
"""
Runtime: O(n^2)
"""
last = len(l)-1
for i in range(last):
for j in range(i+1, last):
if l[i] > l[j]:
l[i], l[j] = l[j], l[i]
return l
print bubblesort([8,2,4,7,9,0,1,4,5,7,8,9])
print bubblesort... | 3.875 | 4 |
diyclock.py | parttimehacker/diyclock | 0 | 12789712 | <gh_stars>0
#!/usr/bin/python3
""" Diyhas clock, motion detector and piezo alarm """
# MIT License
#
# Copyright (c) 2019 <NAME>
#
# 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 re... | 2.078125 | 2 |
code/src/nuvla/job/actions/vulnerabilities_database.py | nuvla/job-engine | 3 | 12789713 | <reponame>nuvla/job-engine<filename>code/src/nuvla/job/actions/vulnerabilities_database.py
# -*- coding: utf-8 -*-
from ..actions import action
import logging
import requests
import gzip
import json
import io
from nuvla.api import NuvlaError
@action('update_vulnerabilities_database')
class VulnerabilitiesDatabaseJo... | 2.40625 | 2 |
vilmedic/datasets/ImSeqLabel.py | jbdel/vilmedic | 15 | 12789714 | import torch
from torch.utils.data import Dataset
from .base.LabelDataset import LabelDataset
from .ImSeq import ImSeq
class ImSeqLabel(Dataset):
def __init__(self, seq, label, image, split, ckpt_dir, **kwargs):
self.split = split
self.imgseq = ImSeq(seq, image, split=split, ckpt_dir=ckpt_dir)
... | 2.515625 | 3 |
students/admin.py | wjarczak/WSB-CRUD | 0 | 12789715 | <gh_stars>0
from django.contrib import admin
from .models import Student, Representative
admin.site.register(Student)
admin.site.register(Representative) | 1.296875 | 1 |
shuffle.py | asix7/RandomScripts | 0 | 12789716 | # Author: <NAME> 2016
# Practice random shuffles, and see their effectiveness
import random
import math
list = ["Hola", "no", "estoy", "aqui", "Javi", "assca"]
# Inplace shuffle
def shuffle(list):
for index in range(0, len(list)):
new_index = random.randint(0, len(list) - 1)
var = list[index]
list[index] = lis... | 3.984375 | 4 |
03-Python/2/Activities/12-Ins_Functions/Solved/functions.py | madhavinamballa/datascience_Berkely | 0 | 12789717 | # Define the function and tell it to print "Hello!" when called
def printHello():
print(f"Hello!")
# Call the function within the application to ensure the code is run
printHello()
# -------------#
# Functions that take in and use parameters can also be defined
def printName(name):
print("Hello " + name + "... | 4.59375 | 5 |
invert_dict.py | brupoon/mustachedNinja | 0 | 12789718 | #invert_dict from 11.4
def invert_dict(d):
invert = dict()
for key in d:
value = d[key]
if value not in invert:
invert[value] = [key]
else:
invert[value].append(key)
return invert
#using setdefault, write a more concise version of invert_dict
def invert_dict_set(d):
invert = dict()
for key in d:
in... | 4.5 | 4 |
Chapter09/findword.py | LuisPereda/Learning_Python | 0 | 12789719 | <filename>Chapter09/findword.py
word = raw_input("Enter the word ")
word = word.lower()
file_txt = open("batman.txt", "r")
count = 0
for each in file_txt:
if word in each.lower():
count = count+1
print "The ", word ," occured ",count, " times"
| 3.796875 | 4 |
dlfairness/original_code/FairALM/Experiments-ChestXRay/random_sample_dataset.py | lin-tan/fairness-variance | 0 | 12789720 | <reponame>lin-tan/fairness-variance
import shutil, random, os
from pathlib import Path
from PIL import Image
dir_path = Path('./raw_data')
dest_path = Path('./tuberculosis-data-processed/')
fn_list = list(dir_path.iterdir())
test_set = random.sample(fn_list, int(len(fn_list) * 0.25)) # Sample 25%
train_dir = Path(de... | 2.40625 | 2 |
src/avmath/algebra.py | ballandt/Evmath | 1 | 12789721 | <reponame>ballandt/Evmath<gh_stars>1-10
"""AVMATH ALGEBRA
AdVanced math algebra submodule containing linear algebra
features tuples, vectors, matrices and systems of linear
equations.
"""
import copy
import logging
from typing import Union, Optional, List
from . import ArgumentError, DimensionError, REAL, Fraction, s... | 2.765625 | 3 |
test/test_grid_interface.py | Anthonyntilelli/prewar_login_game | 1 | 12789722 | """Interface Test with Pytest."""
import pytest # type: ignore
from grid.interface import Interface
from grid.settings import DEFAULT_EASY
# Protected access used to test functions
# Used by fixtures functions
# pylint: disable=W0212, W0621
@pytest.fixture(scope="function")
def easy_interface():
"""Create easy ... | 2.734375 | 3 |
python/20190311/my_djangos/django_share_app/shares/admin.py | Realize0917/career | 3 | 12789723 | from django.contrib import admin
from .models import Upload
admin.site.register(Upload)
| 1.179688 | 1 |
Leak #5 - Lost In Translation/windows/Resources/Dsz/PyScripts/Lib/dsz/mca/status/cmd/uptime/data/dsz/__init__.py | bidhata/EquationGroupLeaks | 9 | 12789724 | # uncompyle6 version 2.9.10
# Python bytecode 2.7 (62211)
# Decompiled from: Python 3.6.0b2 (default, Oct 11 2016, 05:27:10)
# [GCC 6.2.0 20161005]
# Embedded file name: __init__.py
import dsz
import dsz.cmd
import dsz.data
import dsz.lp
class UpTime(dsz.data.Task):
def __init__(self, cmd=None):
dsz.data... | 2.375 | 2 |
profile_generator/model/color/constants.py | nethy/profile-generator | 0 | 12789725 | <filename>profile_generator/model/color/constants.py
from profile_generator.model.color.space import SRGB
from . import lab
MIDDLE_GREY_LUMINANCE_SRGB = SRGB.gamma(lab.to_xyz([50, 0, 0])[1])
| 1.773438 | 2 |
ScratchWork/SkeletonGrabber.py | RoHawks/InnovationChallenge2021 | 0 | 12789726 | import cv2
import pyvirtualcam
import numpy as np
#from pynput import keyboard
from tf_pose import common
from tf_pose.estimator import TfPoseEstimator
from tf_pose.networks import get_graph_path, model_wh
import time
from tf_pose.common import CocoPart
from util import calcThetas
from comparator import compareBodies
i... | 2.625 | 3 |
jphones/phonetizer.py | JRMeyer/jphones | 2 | 12789727 | # The functions here assume input as a list of tokens (ie tokenized sentences),
# where each token was information about whether it is a word or a number.
# The text is assumed to be either japanese of English (target application is
# Japanese text which may contain English or Romanji).
#
# The token type may be (1) Hi... | 3.625 | 4 |
cabot/cabotapp/management/commands/create_cabot_superuser.py | TheBestBurler/cabot | 0 | 12789728 | import os
from django.contrib.auth import get_user_model
from django.core.management.base import BaseCommand
from django.db import IntegrityError
class Command(BaseCommand):
def handle(self, *args, **options):
username = os.environ.get('CABOT_SUPERUSER_USERNAME')
if username:
try:
... | 2.765625 | 3 |
Logos_rc.py | digvijayad/Sentiment-Analysis | 0 | 12789729 | # -*- coding: utf-8 -*-
# Resource object code
#
# Created by: The Resource Compiler for PyQt4 (Qt v4.8.7)
#
# WARNING! All changes made in this file will be lost!
from PyQt4 import QtCore
qt_resource_data = b"\
\x00\x00\x91\xc2\
\x89\
\x50\x4e\x47\x0d\x0a\x1a\x0a\x00\x00\x00\x0d\x49\x48\x44\x52\x00\
\x00\x01\x78\x0... | 1.109375 | 1 |
makahiki/apps/managers/score_mgr/tests.py | justinslee/Wai-Not-Makahiki | 1 | 12789730 | <reponame>justinslee/Wai-Not-Makahiki
"""
test score_mgr
"""
import datetime
from django.test import TransactionTestCase
from django.contrib.auth.models import User
from apps.managers.score_mgr import score_mgr
from apps.managers.team_mgr.models import Group, Team
from apps.managers.score_mgr.models import ScoreboardE... | 2.546875 | 3 |
become_yukarin/dataset/utility.py | nameless-writer/become-yukarin | 562 | 12789731 | <gh_stars>100-1000
import math
import fastdtw
import numpy
_logdb_const = 10.0 / numpy.log(10.0) * numpy.sqrt(2.0)
# should work on torch and numpy arrays
def _sqrt(x):
isnumpy = isinstance(x, numpy.ndarray)
isscalar = numpy.isscalar(x)
return numpy.sqrt(x) if isnumpy else math.sqrt(x) if isscalar else ... | 2.25 | 2 |
python/py-meld3/files/patch-setup.py | svalgaard/macports-ports | 1 | 12789732 | --- setup.py.orig 2007-10-16 16:08:20.000000000 -0700
+++ setup.py 2007-10-16 16:09:22.000000000 -0700
@@ -1,3 +1,5 @@
+from ez_setup import use_setuptools
+use_setuptools()
from distutils.core import setup, Extension
import os
| 1.039063 | 1 |
code/dpp/centers/splines/__init__.py | bsouhaib/qf-tpp | 0 | 12789733 | from .splines_utils import *
| 1.070313 | 1 |
sdbbot_unpacker.py | Tera0017/SDBbot-Unpacker | 11 | 12789734 | <gh_stars>10-100
"""
Author:@Tera0017
SDBbot static unpacker
"""
from sdbbot_unpacker_scripts.sdbbot_rat import SDBbotRatx86, SDBbotRatx64
from sdbbot_unpacker_scripts.sdbbot_loader import SDBbotLoaderx86, SDBbotLoaderx64
from sdbbot_unpacker_scripts.sdbbot_regblob import SDBbotRegBlobx86, SDBbotRegBlobx64
from sdbbot_... | 2.03125 | 2 |
migrations/versions/24fad7bbfc10_drop_sighting_users.py | Matzexxxxx/Monocle | 21 | 12789735 | """drop sighting_users
Revision ID: 24fad<PASSWORD>
Revises: <KEY>
Create Date: 2017-10-22 11:45:40.968564
"""
from alembic import op
import sqlalchemy as sa
import sys
from pathlib import Path
monocle_dir = str(Path(__file__).resolve().parents[2])
if monocle_dir not in sys.path:
sys.path.append(monocle_dir)
from... | 1.398438 | 1 |
Analysis/Pedro/tests/dockTest/logFix.py | taoluwork/bcai | 1 | 12789736 |
f = open('../../data/dockTest/logs.txt', 'r')
line = f.readline()
new = ''
while line != '':
if line.find('top ') >= 0 or line.find('python3') >= 0:
new = new + line
line = f.readline()
f.close()
f = open('../../data/dockTest/logs.txt', 'w')
f.write(new)
f.close() | 2.90625 | 3 |
hytek_parser/export_xls/__init__.py | SwimComm/hytek-parser | 1 | 12789737 | """Header lists for the `csv.DictReader` when reading Hytek-produced CSVs."""
import xlrd
from hytek_parser._utils import safe_cast
from hytek_parser.types import StrOrBytesPath
from ._utils import (
ExportXlsParseError,
extract_plain_value,
extract_time_value,
get_first_row_index,
get_offsets_fro... | 3.0625 | 3 |
part_a/test.py | cconnerolson/aerospace_assignment_6 | 1 | 12789738 | <reponame>cconnerolson/aerospace_assignment_6<gh_stars>1-10
from sympy import *
# fn = A_eq()
g_s = Symbol('g_s')
g_e = Symbol('g_e')
M_e = Symbol('M_e')
A_r = Symbol('A_r')
e1 = sqrt(g_s / g_e)
e2 = 1 / M_e
e3 = (1 + ((g_e - 1) / 2) * M_e**2)**((g_e + 1) / (2 * (g_e - 1)))
e4 = ((g_s + 1) / 2)**((g_s + 1) / (2 * (g... | 2.359375 | 2 |
core/reportlib.py | shad0w008/Scanver | 22 | 12789739 | #!/usr/bin/env python
# encoding=utf-8
#codeby 道长且阻
#email @ydhcui/QQ664284092
from lib.docxtpl import DocxTemplate,InlineImage,RichText
from lib.docx import Document
from lib.docx.shared import Mm, Inches, Pt
from lib.jinja2 import Environment
import time
import re
import uuid
import csv
import base64
import ... | 2.4375 | 2 |
data.py | Jeeprr/selfdriving-raspi | 2 | 12789740 | <filename>data.py<gh_stars>1-10
import pandas as pd
import os
import cv2
import numpy as np
from datetime import datetime
import webcam as W
import controller as cntrl
global imgList, steeringList
countFolder = 0
count = 0
imgList = []
steeringList = []
#GET CURRENT DIRECTORY PATH
myDirectory = os.path.join(os.getcwd... | 2.53125 | 3 |
app/models/base_queries.py | travelteker/flask_api | 0 | 12789741 | <reponame>travelteker/flask_api<filename>app/models/base_queries.py
from typing import Any, Optional, Union
from pymongo.cursor import Cursor
class BaseQueries:
"""Class to centralize commons method to manipulate database mongo"""
def __init__(self, collection: Any):
self.__collection = collection
... | 2.578125 | 3 |
astro_tools.py | ellawang44/astro_tools | 0 | 12789742 | import numpy as np
from scipy.stats.mstats import theilslopes
from scipy.interpolate import CubicSpline
import matplotlib.pyplot as plt
# define constants
_c = 299792.458 # speed of light in km s^-1
class SpecAnalysis:
'''Analyse astronomy spectra.
'''
def __init__(self, wavelength, flux, flux_err=None)... | 2.703125 | 3 |
scripts/scratch.py | lewisjared/netcdf-scm | 0 | 12789743 | <gh_stars>0
import pdb
from netcdf_scm.iris_cube_wrappers import CMIP6OutputCube
test = CMIP6OutputCube()
pdb.set_trace()
test.load_data_in_directory(
"/data/marble/cmip6/CMIP6/CMIP/NCAR/CESM2/historical/r10i1p1f1/Omon/tos/gn/v20190313/"
)
test.load_data_in_directory(
"tests/test-data/cmip6output/CMIP6/CMIP... | 1.5625 | 2 |
Skydipper/utils.py | Skydipper/LMIPy | 0 | 12789744 | <reponame>Skydipper/LMIPy<filename>Skydipper/utils.py
import json
import math
import ee
from time import sleep
from google.cloud import storage
def html_box(item):
"""Returns an HTML block with template strings filled-in based on item attributes."""
is_layer = str(type(item)) == "<class 'Skydipper.layer.Layer'... | 2.734375 | 3 |
client.py | sammachin/twiliopaging | 1 | 12789745 | <reponame>sammachin/twiliopaging<filename>client.py
#!/usr/bin/env python
import pusherclient
import json
from soco import SoCo
from soco import SonosDiscovery
import time
global pusher
pusher_key = ''
def connect_handler(data):
channel = pusher.subscribe('airpage')
channel.bind('message', callback)
def ca... | 2.03125 | 2 |
Examples/Python/SDK/manipulate/PerformSeveralOperationsOnImage.py | naeem244/Aspose.Imaging-for-Cloud | 0 | 12789746 | <gh_stars>0
import common
input_file = "sample1.png"
input_path = common.get_path(__file__, input_file)
output_file = "output.jpg"
output_path = common.get_path(__file__, output_file)
format = "jpg"
x = 96
y = 96
newWidth = 300
newHeight = 300
rectWidth = 200
rectHeight = 200
rotateFlipMethod = ""
# invoke Aspose.Im... | 3.078125 | 3 |
pyexamples/outside30k.py | carhartt21/PlotNeuralNet | 1 | 12789747 | import sys
import os
sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
import pycore.tikz as tikz
import pycore.blocks as blocks
import pycore.execute as execute
def create_architecture():
input = 40
base_width = 64
arch = []
arch += tikz.start()
arch += tikz.image(name... | 2.3125 | 2 |
src/shodan.py | throne/throne-cli | 4 | 12789748 | <filename>src/shodan.py
# LICENSED UNDER BSD-3-CLAUSE-CLEAR LICENSE
# SEE PROVIDED LICENSE FILE IN ROOT DIRECTORY
# Import Third Party Modules
import logging
import click
import yaml
import os
from pathlib import Path
# Import Throne Modules
from src.parsers import json_request, shodan_parser
from src.exceptions impor... | 1.976563 | 2 |
tests/resources/test_conferences.py | vaibhav-plivo/plivo-python | 0 | 12789749 | <reponame>vaibhav-plivo/plivo-python<filename>tests/resources/test_conferences.py
# -*- coding: utf-8 -*-
from tests.decorators import with_response
from .. import PlivoResourceTestCase
conference_name = 'My Conf Room'
member_id = 'Test Member ID'
class ConferenceTest(PlivoResourceTestCase):
@with_response(200)... | 2.390625 | 2 |
setup.py | jntme/twjnt | 0 | 12789750 | from distutils.core import setup
setup(
name='twjnt',
version='0.0.1',
packages=[''],
url='',
license='MIT',
author='jntme',
author_email='<EMAIL>',
description='A simple tool that offers some features to administrate your twitter account.'
)
| 1.125 | 1 |