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 |
|---|---|---|---|---|---|---|
_unittests/ut_grabber/test_box_mock_render.py | sdpython/pymmails | 3 | 12785651 | <gh_stars>1-10
# -*- coding: utf-8 -*-
"""
@brief test log(time=2s)
"""
import os
import unittest
from pyquickhelper.loghelper import fLOG
from pyquickhelper.pycode import get_temp_folder
from pymmails import MailBoxMock, EmailMessageRenderer, EmailMessageListRenderer
class TestMessageBoxMock(unittest.TestCase):... | 2.296875 | 2 |
blogSite/blog/templatetags/blog_tags.py | sharafx2qeshta/Django-3-by-example | 0 | 12785652 | # this file for custom tags
from django import template
from ..models import Post
from django.db.models import Count
# these two lines below for custom filters
from django.utils.safestring import mark_safe
import markdown
register = template.Library()
'''
Each module that contains template tags needs to defi... | 2.71875 | 3 |
irrd/server/whois/query_parser.py | morrowc/irrd | 0 | 12785653 | import logging
import re
from typing import Optional
import ujson
from IPy import IP
from ordered_set import OrderedSet
from irrd import __version__
from irrd.conf import get_setting, RPKI_IRR_PSEUDO_SOURCE
from irrd.mirroring.nrtm_generator import NRTMGenerator, NRTMGeneratorException
from irrd.rpki.status import RP... | 1.851563 | 2 |
ci/clean-cluster.py | azatoth/telepresence | 0 | 12785654 | #!/usr/bin/env python3
"""
Delete old deployments and services with test-prefixed names. This is used to
clean up the Telepresence test cluster, as Telepresence tests currently leak.
"""
import argparse
import datetime
import json
from subprocess import check_output
from typing import Dict, List
def get_kubectl() ->... | 2.390625 | 2 |
cibyl/utils/dicts.py | rhos-infra/cibyl | 3 | 12785655 | """
# Copyright 2022 Red Hat
#
# 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... | 2.28125 | 2 |
braponto-back/core/serializers.py | TheRodrigoBraga/Braponto | 0 | 12785656 | <reponame>TheRodrigoBraga/Braponto<filename>braponto-back/core/serializers.py
from rest_framework import serializers
from .models import Funcionario
from .models import Registro
class FuncionarioSerializer(serializers.ModelSerializer):
class Meta:
model = Funcionario
fields = ['id', 'matricula', 'n... | 2.03125 | 2 |
sagas/ofbiz/finder.py | samlet/stack | 3 | 12785657 | <reponame>samlet/stack
import sagas.ofbiz.connector
from py4j.java_gateway import java_import
class Finder(object):
def __init__(self, oc):
self.oc=oc
java_import(oc.j, 'org.apache.ofbiz.service.ServiceUtil')
java_import(oc.j, 'org.apache.ofbiz.base.util.UtilDateTime')
java_import(... | 1.984375 | 2 |
log_parser/row_parsers.py | LightRevan/log_parse | 0 | 12785658 | <reponame>LightRevan/log_parse<gh_stars>0
# -*- coding: utf-8 -*-
__author__ = 'lightrevan'
import re
import functools
import collections
import datetime as dt
class RowParsingError(LookupError):
pass
def not_none_transform(match):
if match is None:
raise RowParsingError
else:
return ma... | 2.546875 | 3 |
chemex/experiments/relaxation_nz.py | gbouvignies/ChemEx | 10 | 12785659 | """
15N T1
======
Analyzes 15N T1 experiments. This keeps the spin system purely in-phase
throughout, and is calculated using the (1n)×(1n), single-spin matrix,
where n is the number of states::
{ Iz(a), Iz(b), ... }
References
----------
Kay, Nicholson, Delaglio, Bax, and Torchia. J Mag Reson (1992) 97:359-375... | 2.25 | 2 |
bin/filter_msa.py | CFIA-NCFAD/scovtree | 0 | 12785660 | <reponame>CFIA-NCFAD/scovtree
#!/usr/bin/env python3
import logging
import sys
from collections import defaultdict
from pathlib import Path
from typing import Dict, Set, Tuple, Mapping, Optional
import pandas as pd
import typer
from Bio.SeqIO.FastaIO import SimpleFastaParser
from rich.logging import RichHandler
def ... | 1.953125 | 2 |
python/chap_0/0.5.5.py | RyodoTanaka/Cording_Matrix | 0 | 12785661 | <filename>python/chap_0/0.5.5.py<gh_stars>0
#!/usr/bin/env python
# -*- coding: utf-8 -*-
x={1,2,3,4,5}
ret={i**2 for i in x}
print ret
| 2.4375 | 2 |
functions.py | theSlayer4089/EasyFNBotGlitch | 2 | 12785662 | import fortnitepy,fortniteAPI
async def SetCosmeticMSG(self,message):
msg = message.content.upper().strip()
args = msg.split(" ")
Lang = self.DefaultLang
if "--LANG=" in msg:
msg = msg + " "
Lang = GetValue(msg,"--LANG="," ")
msg = msg.replace("--LANG=" + Lang, "").st... | 2.453125 | 2 |
test/test_add_group.py | Zaichkov/python_training | 0 | 12785663 | <gh_stars>0
from model.group import Group
import pytest
import re
# @pytest.mark.parametrize("group", test_data, ids=[repr(x) for x in test_data])
def test_add_group(app, orm, json_groups, check_ui):
group = json_groups
old_groups = orm.get_group_list()
app.group.create(group)
new_groups = orm.get_gro... | 2.46875 | 2 |
tests/cloud_client_test.py | dgorissen/dronekit-python | 0 | 12785664 | <filename>tests/cloud_client_test.py
import unittest
import os
from droneapi.lib.CloudClient import *
class CloudClientTest(unittest.TestCase):
def __init__(self, *args, **kwargs):
api_key = os.environ['DRONEAPI_KEY']
self.api = CloudClient(api_key)
super(CloudClientTest, self).__init__(*ar... | 2.65625 | 3 |
bundle/fpga_simu.py | davidbrochart/bundle | 4 | 12785665 | from pyclk import Sig, Reg, In, Out, List, Module
from .memory import memory
from .ddr2fpga import ddr2fpga
from .fpga2ddr import fpga2ddr
from .iterator import iterator
from .functions import func
from .fpga_state import FPGA_state
from random import randint
import asyncio
import numpy as np
class Simu(Module):
... | 2.328125 | 2 |
dandi/metadata.py | AlmightyYakob/dandi-cli | 0 | 12785666 | from datetime import datetime
import os.path as op
import re
from uuid import uuid4
from . import models
from .pynwb_utils import (
_get_pynwb_metadata,
get_neurodata_types,
get_nwb_version,
ignore_benign_pynwb_warnings,
metadata_cache,
)
from .utils import ensure_datetime
from . import __version__... | 1.96875 | 2 |
src/user.py | livibetter/twimonial | 0 | 12785667 | import logging
import os
from google.appengine.api import memcache
from google.appengine.ext import webapp
from google.appengine.ext.webapp import template
from google.appengine.ext.webapp.util import run_wsgi_app
from twimonial.models import User, Twimonial
from twimonial.ui import render_write
import config
class... | 2.0625 | 2 |
route.py | LemonPi/Pathtreker | 1 | 12785668 | import queue
import networkx
from math import radians, sin, cos, sqrt, asin
from util import hav
def shortest_path(g, source, dest):
"""Return single source single destination shortest path using A* search.
Haversine distance is used as heuristic.
Arguments:
g -- networkx graph loaded from shapefile
source ... | 3.6875 | 4 |
package/spack-curl/package.py | ctuning/ck-spack | 1 | 12785669 | ##############################################################################
# Copyright (c) 2013-2018, Lawrence Livermore National Security, LLC.
# Produced at the Lawrence Livermore National Laboratory.
#
# This file is part of Spack.
# Created by <NAME>, <EMAIL>, All rights reserved.
# LLNL-CODE-647188
#
# For det... | 1.773438 | 2 |
mlcomp/__version__.py | gorogoroyasu/mlcomp | 0 | 12785670 | <filename>mlcomp/__version__.py<gh_stars>0
__version__ = '19.10'
| 1.023438 | 1 |
atest/testdata/keywords/PositionalOnly.py | bhirsz/robotframework | 7,073 | 12785671 | def one_argument(arg, /):
return arg.upper()
def three_arguments(a, b, c, /):
return '-'.join([a, b, c])
def with_normal(posonly, /, normal):
return posonly + '-' + normal
def defaults(required, optional='default', /):
return required + '-' + optional
def types(first: int, second: float, /):
... | 3.15625 | 3 |
rx/internal/basic.py | mmpio/RxPY | 4,342 | 12785672 | from typing import Any
from datetime import datetime
# Defaults
def noop(*args, **kw):
"""No operation. Returns nothing"""
pass
def identity(x: Any) -> Any:
"""Returns argument x"""
return x
def default_now() -> datetime:
return datetime.utcnow()
def default_comparer(x: Any, y: Any) -> bool:... | 2.953125 | 3 |
wxgigo/wxmp/api/webauth.py | rfancn/wxgigo | 0 | 12785673 | #!/usr/bin/env python
# coding=utf-8
"""
Copyright (C) 2010-2013, <NAME> <<EMAIL>>
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 2 of the License, or
(at your option) any later ... | 2.234375 | 2 |
src/simod/writers/xml_writer.py | Mcamargo85/SiMo-Discoverer | 12 | 12785674 | <filename>src/simod/writers/xml_writer.py
import uuid
from lxml import etree
from lxml.builder import ElementMaker # lxml only !
# --------------- General methods ----------------
from simod.configuration import QBP_NAMESPACE_URI
def create_file(output_file, element):
# file_exist = os.path.exists(output_f... | 2.40625 | 2 |
hkpy/hkpyo/model/hko_model.py | renan-souza/hkpy | 7 | 12785675 | <gh_stars>1-10
###
# Copyright (c) 2019-present, IBM Research
# Licensed under The MIT License [see LICENSE for details]
###
import json
from collections import Counter
from typing import TypeVar, Union, Dict
from hkpy import hkfy
CONCEPT_IRI = "http://brl.ibm.com/ontologies/hko#Concept"
PROPERTY_IRI = "http://brl.... | 2.203125 | 2 |
plot_clustering.py | lthUniBonn/AWERA | 0 | 12785676 | <gh_stars>0
from AWERA import config, reference_locs, ChainAWERA
import time
from AWERA.utils.convenience_utils import write_timing_info
since = time.time()
if __name__ == '__main__':
add_plot_eval_dir = 'clustering/'
# read config from jobnumber
# 8 small jobs
# 4 big jobs
# settings_id = int(os.e... | 1.8125 | 2 |
filter_provider.py | aniloutdo/Fitness-Gadgets | 2 | 12785677 | <gh_stars>1-10
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from numpy import arange
class AcceptanceTester:
"""Tests data points for acceptance into dataset_container."""
def __init__(self, tester_type):
"""Initialize with the type of data to test.
Parameters
----------
... | 3.265625 | 3 |
conjur/controller/hostfactory_controller.py | cyberark/conjur-api-python3 | 16 | 12785678 | <gh_stars>10-100
# -*- coding: utf-8 -*-
"""
HostFactoryController
This Module represents the Presentation Layer for the HostFactory command
"""
import http
import logging
import sys
# Internals
from conjur.errors import MissingRequiredParameterException
from conjur.data_object.create_token_data import CreateTokenDat... | 2.515625 | 3 |
test.py | EMUN123/TTF-xunlei | 0 | 12785679 | <reponame>EMUN123/TTF-xunlei<filename>test.py<gh_stars>0
import os
import re
# in the following codes, I almost made every important mistakes about re...
file_list = os.listdir(r'C:\Users\HZB\Downloads')
file_str = "match".join(file_list)
'''
re can't deel with "()" in english, we need to switch it into sth els... | 2.703125 | 3 |
optionvisualizer/utilities.py | GBERESEARCH/optionvisualizer | 8 | 12785680 | <gh_stars>1-10
"""
Utility functions for refreshing parameters
"""
import copy
import numpy as np
import scipy.stats as si
from optionvisualizer.visualizer_params import vis_params_dict
# pylint: disable=invalid-name
class Utils():
"""
Utility functions for refreshing parameters
"""
@staticmethod
... | 2.65625 | 3 |
C-logging/logging_example3.py | johnehunt/PythonCleanCode | 1 | 12785681 | # Using the logger.exception() method
import logging
logger = logging.getLogger()
try:
print('starting')
x = 1 / 0
print(x)
except:
logger.exception('an exception message')
print('Done')
| 3.09375 | 3 |
examples/pytorch/gin/gin.py | ydwu4/dgl-hack | 0 | 12785682 | <gh_stars>0
"""
How Powerful are Graph Neural Networks
https://arxiv.org/abs/1810.00826
https://openreview.net/forum?id=ryGs6iA5Km
Author's implementation: https://github.com/weihua916/powerful-gnns
"""
import torch
import torch as th
import torch.nn as nn
import torch.nn.functional as F
import dgl
from dgl.nn.pytorc... | 3.265625 | 3 |
motor_controls/getArduinoData2.py | ArifSohaib/AutonomousRobotChallenge | 13 | 12785683 | # import curses and GPIO
import curses
import serial
import time
from picamera.array import PiRGBArray
from picamera import PiCamera
import cv2
import numpy as np
ser = serial.Serial("/dev/ttyUSB0", "9600")
serLidar = serial.Serial("/dev/ttyACM0", "115200")
cap = cv2.VideoCapture(0)
piCam = False
#check if picamera ex... | 2.796875 | 3 |
mitmirror/data/security/authorization.py | Claayton/mitmirror-api | 0 | 12785684 | <reponame>Claayton/mitmirror-api
"""Caso de uso: Authorization"""
from typing import Type
from fastapi import Request as RequestFastApi
import jwt
from mitmirror.data.interfaces import UserRepositoryInterface
from mitmirror.domain.usecases import AuthorizationInterface
from mitmirror.errors import HttpUnauthorized, Htt... | 2.390625 | 2 |
examples/tridimensional.py | rennelou/rust-fdmbpm | 0 | 12785685 | <reponame>rennelou/rust-fdmbpm<filename>examples/tridimensional.py
import h5py
import optical_waveguide
import numpy as np
import matplotlib.pyplot as plt
origin = 'lower'
lines = 50
output_filename = "tridimensional_result.h5"
x_axis = optical_waveguide.get_axis(40, 0.4)
y_axis = optical_waveguide.get_axis(40, 0.4)... | 2.078125 | 2 |
applications/tenant/fields.py | dev-easyshares/mighty | 0 | 12785686 | <reponame>dev-easyshares/mighty
tenant = ('group', 'user', 'sync', 'invitation', 'roles')
#tenant_alternate = ('tenant', 'alternate', 'position')
role = ('group', 'name', 'is_immutable', 'number',)
tenant_invitation = ('group', 'email', 'by', 'roles', 'tenant', 'status', 'token') | 1.34375 | 1 |
src/transformer_deploy/backends/pytorch_utils.py | dumpmemory/transformer-deploy | 698 | 12785687 | <filename>src/transformer_deploy/backends/pytorch_utils.py
# Copyright 2022, <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
#
# ... | 2 | 2 |
lucid4keras/optimizers.py | smgpulse007/lucid4keras | 15 | 12785688 | <reponame>smgpulse007/lucid4keras
import numpy as np
def rmsprop(grads, cache=None, decay_rate=0.95):
if cache is None:
cache = np.zeros_like(grads)
cache = decay_rate * cache + (1 - decay_rate) * grads ** 2
step = -grads / np.sqrt(cache + 1e-8)
return step, cache
def adam(grads, cache_m,... | 2.296875 | 2 |
gs/group/messages/topic/base/latestpost.py | groupserver/gs.group.messages.topic.base | 0 | 12785689 | # -*- coding: utf-8 -*-
############################################################################
#
# Copyright © 2013, 2015 OnlineGroups.net and Contributors.
# All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.1 (ZPL). A copy of the ZPL should accompany th... | 1.960938 | 2 |
reward/batcher/prioritized_replay_batcher.py | lgvaz/torchrl | 5 | 12785690 | <gh_stars>1-10
import reward.utils as U
from reward.batcher import ReplayBatcher
from reward.utils.buffers import PrReplayBuffer
# TODO: Fix args and kwargs
class PrReplayBatcher(ReplayBatcher):
def __init__(
self,
*args,
min_pr=0.01,
pr_factor=0.6,
is_factor=1.,
rb... | 2.109375 | 2 |
templateMatching_classes.py | Fs-agadir/StageDetect | 0 | 12785691 | # Copyright (c) 2021, Fs-Agadir
# All rights reserved.
import numpy as np
import pylab as plt
import cv2
#perform template matching in images to detect GCPs
class templateMatch:
#define template position and size and search area position
def __init__(self, template_size_x=300, template_size_y=300,
... | 2.71875 | 3 |
predict.py | hdvvip/AI_Image_Classifier | 0 | 12785692 | <reponame>hdvvip/AI_Image_Classifier
from functions_col import import_func, process_image, imshow, predict, save_checkpoint, load_checkpoint, load_train_data, load_val_data, train_model, get_key_from_value
import argparse
import pandas as pd
import numpy as np
import torch
from torch import nn,optim
import torch.nn.... | 2.640625 | 3 |
runtime/stdlib/jitlog.py | cheery/lever | 136 | 12785693 | <gh_stars>100-1000
# There is a convenient PYPYLOG=jit-log-opt:logfile
# to enable jit logging from outside.
# But I like having the option to
# enable it from the inside.
from rpython.rtyper.lltypesystem import rffi, lltype, llmemory
from rpython.rlib.rjitlog import rjitlog
from rpython.rlib import jit
from space impo... | 1.8125 | 2 |
tests/integration/operators_test/asinh_test.py | gglin001/popart | 61 | 12785694 | # Copyright (c) 2020 Graphcore Ltd. All rights reserved.
import numpy as np
import popart
import torch
from op_tester import op_tester
def test_asinh(op_tester):
# create test data
# Notice: as asinh(x) = ln(x + sqrt(x^2 + 1)), absolute precision
# deteriorates for larger negative numbers as you will have... | 2.1875 | 2 |
actions.py | ElectricMaxxx/jon-knows-rasa | 0 | 12785695 | <filename>actions.py
import logging
import json
from rasa_core.actions import Action
from rasa_core.events import AllSlotsReset
class ActionWhoKnowsTopic(Action):
def name(self):
return 'action_who_knows_topic'
def run(self, dispatcher, tracker, domain):
topic = tracker.get_slot('topic') if tr... | 2.5 | 2 |
Python/kepco.py | ultpnml/ult_instruments | 1 | 12785696 | <gh_stars>1-10
#Controls KEPCO BHK 2000-0.1MG high voltage power supply
#For now, it only reads. It does not set voltage/current.
import visa
class kepco:
#The primary address is assumed to be 6
def __init__(self, address = 6, gpib_num = 1):
self.primary_id = 'GPIB' + str(gpib_num) + '::' ... | 2.890625 | 3 |
src/pythontemplate/example.py | colms/pythontemplate | 0 | 12785697 | import argparse
def add_one(num: int) -> int:
if not num:
return 0
return num + 1
def add_with_args(num: int) -> int:
added = add_one(num)
return added
def parse_command_line_args() -> argparse.Namespace:
parser = argparse.ArgumentParser(description='My python template.')
parser.ad... | 3.734375 | 4 |
test_80.py | VinkDong/scripts | 0 | 12785698 | <filename>test_80.py
from werkzeug.wrappers import Request, Response
@Request.application
def application(request):
return Response('Hello World! 80 port')
if __name__ == '__main__':
from werkzeug.serving import run_simple
run_simple('0.0.0.0', 80, application) | 2 | 2 |
examples/stable_radical_optimization/stable_radical_molecule_state.py | dmdu/rlmolecule | 0 | 12785699 | <reponame>dmdu/rlmolecule
from typing import Optional, Sequence
import rdkit
from rdkit import Chem
from rdkit.Chem import Mol, MolToSmiles
from rlmolecule.molecule.molecule_state import MoleculeState
from rlmolecule.molecule.builder.builder import AddNewAtomsAndBonds
class StableRadMoleculeState(MoleculeState):
... | 2.625 | 3 |
packages/core/minos-microservice-common/minos/common/datetime.py | sorasful/minos-python | 247 | 12785700 | from datetime import (
datetime,
timezone,
)
def current_datetime() -> datetime:
"""Get current datetime in `UTC`.
:return: A ``datetime`` instance.
"""
return datetime.now(tz=timezone.utc)
NULL_DATETIME = datetime.max.replace(tzinfo=timezone.utc)
| 3.140625 | 3 |
pyroms_toolbox/pyroms_toolbox/BGrid_GFDL/__init__.py | dcherian/pyroms | 1 | 12785701 | """
BGrid_GFDL module
"""
from BGrid_GFDL import BGrid_GFDL
from get_nc_BGrid_GFDL import get_nc_BGrid_GFDL
from make_remap_grid_file import make_remap_grid_file
from get_coast_line import get_coast_line
from plot_coast_line import plot_coast_line
from get_Bgrid_proj import get_Bgrid_proj
from flood import flood
| 1.203125 | 1 |
neverlose/models/base/event.py | neverlosecc/api-wrapper | 2 | 12785702 | <reponame>neverlosecc/api-wrapper
from pydantic import BaseModel
class BaseEvent(BaseModel):
unique_id: int
signature: str
| 1.632813 | 2 |
painting.py | applejenny66/PythonDrawing | 0 | 12785703 | # painting.py
import os
import cv2 as cv
import numpy as np
from matplotlib import pyplot as plt
from preprocess import Kmeans
from monitor import Monitor
import tkinter as tk
import csv
from utils import BlankImg
class Painting():
def __init__(self, K, shape):
#self.radius = 3
self.K = K
... | 3.015625 | 3 |
pages/views.py | Garinmckayl/monet | 0 | 12785704 |
import re
import requests
from accounts.models import Company, CustomUser
from django.contrib.auth.decorators import login_required
from django.shortcuts import redirect, render
from django.urls import reverse
from django.views import View
from django.views.generic import DetailView, ListView, TemplateView
from django... | 2.109375 | 2 |
examples/diameter-app2/bromelia_hss.py | post-cyberlabs/bromelia | 25 | 12785705 | # -*- coding: utf-8 -*-
"""
examples.bromelia_hss
~~~~~~~~~~~~~~~~~~~~~
This module contains an example on how to setup a dummy HSS
by using the Bromelia class features of bromelia library.
:copyright: (c) 2020 <NAME>.
:license: MIT, see LICENSE for more details.
"""
import os
import sys
ba... | 2.015625 | 2 |
setup.py | OscarSilvaOfficial/fast_orm | 2 | 12785706 | import setuptools
with open("README.md", "r", encoding="utf-8") as fh:
long_description = fh.read()
setuptools.setup(
name="fast_sql_manager",
version="0.1.5",
author="<NAME>",
author_email="<EMAIL>",
description="Um pacote simples para realizar operações no banco",
long_description=long_d... | 1.421875 | 1 |
cq/views.py | furious-luke/django-cq | 31 | 12785707 | from django.db import transaction
from rest_framework import viewsets
from .serializers import TaskSerializer, CreateTaskSerializer
from .models import Task
class TaskViewSet(viewsets.ModelViewSet):
queryset = Task.objects.all()
serializer_class = TaskSerializer
def get_serializer(self, data=None, *args... | 2.140625 | 2 |
Code/Python/Kamaelia/Kamaelia/BaseIPC.py | sparkslabs/kamaelia_orig | 12 | 12785708 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright 2010 British Broadcasting Corporation and Kamaelia Contributors(1)
#
# (1) Kamaelia Contributors are listed in the AUTHORS file and at
# http://www.kamaelia.org/AUTHORS - please extend this file,
# not this notice.
#
# Licensed under the Apache License... | 2.359375 | 2 |
paranoia_data.py | reckenrode/ParanoiaCharGen | 1 | 12785709 | import operator
specs = {
'Management': ['Bootlicking', 'Chutzpah', 'Hygiene', 'Con Games',
'Interrogation', 'Intimidation', 'Moxie', 'Oratory'],
'Stealth': ['Concealment', 'Disguise', 'High Alert',
'Security Systems', 'Shadowing', 'Sleight of Hand',
'Sneaking... | 1.648438 | 2 |
tardis/gui/tests/test_gui.py | saksham-kaushal/tardis | 1 | 12785710 | <filename>tardis/gui/tests/test_gui.py<gh_stars>1-10
import os
import pytest
from tardis.io.config_reader import Configuration
from tardis.simulation import Simulation
import astropy.units as u
from tardis.gui import interface
from tardis.gui.widgets import Tardis
from tardis.gui.datahandler import SimpleTableModel
fr... | 1.984375 | 2 |
techk/apps/base/configs.py | danilovergara/fullstack | 0 | 12785711 | <filename>techk/apps/base/configs.py
scraper_url = "http://books.toscrape.com/" # The URL to be scraped | 1.476563 | 1 |
Task/Even-or-odd/Python/even-or-odd-1.py | LaudateCorpus1/RosettaCodeData | 5 | 12785712 | <reponame>LaudateCorpus1/RosettaCodeData<filename>Task/Even-or-odd/Python/even-or-odd-1.py<gh_stars>1-10
>>> def is_odd(i): return bool(i & 1)
>>> def is_even(i): return not is_odd(i)
>>> [(j, is_odd(j)) for j in range(10)]
[(0, False), (1, True), (2, False), (3, True), (4, False), (5, True), (6, False), (7, True), (... | 3.390625 | 3 |
ML_service/run_classifier_app.py | ykpgrr/Hate-Speech-Detection | 4 | 12785713 | import os
import pickle
import re
import string
from flask import Flask, request, jsonify
CUR_DIR = os.path.dirname(__file__)
STOP_WORDS = pickle.load(open(
os.path.join(CUR_DIR,
'pkl_objects',
'stopwords.pkl'), 'rb'))
VECTORIZER = pickle.load(open(
os.path.join(CUR_DIR,
... | 2.859375 | 3 |
src/users/models/componentsschemasmicrosoft_graph_onenoteentitybasemodelallof1.py | peombwa/Sample-Graph-Python-Client | 0 | 12785714 | <filename>src/users/models/componentsschemasmicrosoft_graph_onenoteentitybasemodelallof1.py<gh_stars>0
# coding=utf-8
# --------------------------------------------------------------------------
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the cod... | 2.09375 | 2 |
testdata/python/setup/setup.py | lade-io/jet | 18 | 12785715 | try:
from setuptools import setup
except ImportError:
from distutils.core import setup
REQUIRES = ['numpy', 'pytest', 'flask']
config = {
'description': 'Fibonacci webservice (with neural network)',
'author': '<NAME>',
'url': 'https://github.com/soerendip/fibo',
'download_url': 'https://github... | 1.460938 | 1 |
venv/lib/python3.8/site-packages/azureml/_tracing/_tracer.py | amcclead7336/Enterprise_Data_Science_Final | 0 | 12785716 | <reponame>amcclead7336/Enterprise_Data_Science_Final
# ---------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# ---------------------------------------------------------
import os
from ._constants import USER_FACING_NAME, TRACEPARENT_ENV_VAR
from ._s... | 2.0625 | 2 |
wpca/tests/test_utils.py | radicamc/wpca | 123 | 12785717 | from itertools import chain, combinations
import numpy as np
from numpy.testing import assert_allclose
from wpca.tests.tools import assert_allclose_upto_sign
from wpca.utils import orthonormalize, random_orthonormal, weighted_mean
def test_orthonormalize():
rand = np.random.RandomState(42)
X = rand.randn(3,... | 2.375 | 2 |
notebooks/utils.py | djfedos/djfedos-boostrap | 0 | 12785718 | def find_max(list_of_numbers:list):
max_number = list_of_numbers[0]
for number in list_of_numbers:
if number > max_number:
max_number = number
return(max_number) | 3.796875 | 4 |
src/bxcommon/models/blockchain_peer_info.py | dolphinridercrypto/bxcommon | 12 | 12785719 | <reponame>dolphinridercrypto/bxcommon<filename>src/bxcommon/models/blockchain_peer_info.py
from dataclasses import dataclass
from typing import Optional
from bxcommon.utils.blockchain_utils.eth import eth_common_constants
@dataclass
class BlockchainPeerInfo:
ip: str
port: int
node_public_key: Optional[st... | 2.453125 | 2 |
Camera_comments.py | JoseZalez/Houdini-scripts | 19 | 12785720 | <filename>Camera_comments.py<gh_stars>10-100
#Add parameters to the camera
#https://www.linkedin.com/in/jose-gonzalezvfx/
import os
import sys
from PySide2.QtWidgets import QDialog, QApplication, QLineEdit, QLabel, QPushButton, QCheckBox, QHBoxLayout, QVBoxLayout
from PySide2.QtCore import Qt
class UI(QDialog):
... | 2.65625 | 3 |
examples/turbulence.py | andimarafioti/python-acoustics | 1 | 12785721 | import numpy as np
from acoustics.turbulence import Gaussian2DTemp, VonKarman2DTemp, Comparison, Field2D
def main():
mu_0 = np.sqrt(10.0**(-6))
correlation_length = 1.0 # Typical correlation length for Gaussian spectrum.
x = 20.0
y = 0.0
z = 40.0
plane = (1,0,1)
#f_re... | 3.1875 | 3 |
LightSail.py | CFP106020008/Light-Sail-Simulation | 0 | 12785722 | <filename>LightSail.py
# -*- coding: utf-8 -*-
"""
Created on Wed Mar 24 01:09:23 2021
@author: <EMAIL>
"""
import numpy as np
import matplotlib.pyplot as plt
from scipy.integrate import solve_ivp
import matplotlib.cm as cm
from matplotlib.animation import FuncAnimation
import matplotlib as mpl
from matp... | 2.875 | 3 |
tests/test_0434.py | msztylko/2020ify-leetcoding | 0 | 12785723 | import ctypes
import pytest
c_lib = ctypes.CDLL('../solutions/0434-segment-string/segment-string.so')
@pytest.mark.parametrize('str, ans',
[(b'Hello, my name is John', 5),
(b'Hello', 1),
(b"love live! mu'sic forever", 4),
(b"", 0)])
def test_segment_string(str, ans):
out = c_lib.countSegments(str)
assert o... | 2.421875 | 2 |
polyaxon/hpsearch/tasks/health.py | elyase/polyaxon | 0 | 12785724 | <gh_stars>0
from checks import health_task
from polyaxon.celery_api import celery_app
from polyaxon.settings import HPCeleryTasks
@celery_app.task(name=HPCeleryTasks.HP_HEALTH, ignore_result=False)
def hp_health(x, y):
return health_task.health_task(x, y)
| 1.59375 | 2 |
openhgnn/trainerflow/GATNE_trainer.py | clearhanhui/OpenHGNN | 0 | 12785725 | import torch as th
from tqdm import tqdm
from . import BaseFlow, register_flow
from ..models import build_model
from ..models.GATNE import NSLoss
import torch
from tqdm.auto import tqdm
from numpy import random
import dgl
from ..sampler.GATNE_sampler import NeighborSampler, generate_pairs
@register_flow("GATNE_traine... | 2.078125 | 2 |
STACK/minStack.py | rajansh87/Algorithms-Implementations | 1 | 12785726 | class Stack:
def __init__(self):
self.min = None
self.stack = list()
# function to get minimum element of the stack
def getMin(self):
if len(self.stack) == 0:
return -1
else:
return self.min
# function to return the top element
def t... | 3.921875 | 4 |
c/exam/B.py | wangrunlin/lanqiao | 0 | 12785727 | n = 2020
cnt = 0
for i in range(2, n+1):
tmp = i
while tmp > 1:
if tmp % 10 == 2:
cnt += 1
tmp /= 10
print(cnt)
| 3.25 | 3 |
Building/urls.py | LukaszHoszowski/Django_ProEstate | 1 | 12785728 | <gh_stars>1-10
from django.urls import path
from Building.views import BuildingListView, BuildingDetailView, \
BuildingCartographyView, BuildingCoopView, BuildingPhotosView, BuildingDocsView, BuildingPhotosCreate, \
BuildingDocsCreate, BuildingFlatsView, FlatDetailView, FlatUpdateView, FlatAddUserUpdate, FlatD... | 1.867188 | 2 |
provider_daft/app/main.py | madpin/renthub | 0 | 12785729 | # import logging
from pathlib import Path
from enum import Enum
import uvicorn
from fastapi import FastAPI
from custom_logger import CustomizeLogger
import schemas
from mappings.daft_listings import get_daft_search_result
from mappings.listing_details import get_listing_details
# logger = logging.getLogger(__name_... | 2.328125 | 2 |
src/JaccardWikipediaHeart.py | nik7273/computational-medical-knowledge | 0 | 12785730 | # -*- coding: utf-8 -*-
#GET JACCARD SIMILARITY OF ALL HEART RELATED ARTICLES ON WIKIPEDIA (BETWEEN THEMSELVES)
from utils import jaccard
import wikipedia, codecs, nltk
from findRelevantArticles import findRelevantArticles
from pprint import pprint
from nltk.corpus import stopwords
from nltk.tokenize import word_toke... | 2.96875 | 3 |
test.py | mu2019/pyrestrecord | 0 | 12785731 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import restrecord
a=restrecord.Meta()
a.a = 'abc'
a.b = 1
print(a['a'],a.a,a.b)
del a.a
print(a.a)
print(dir(a))
print('record')
rc = restrecord.Record((['a','b'],[1,2]))
print(rc.keys())
print(rc[0],rc.a
| 2.421875 | 2 |
cogs/mod.py | jeraldlyh/horizon | 2 | 12785732 | import asyncio
import discord
import datetime
import pytz
import random
import colorsys
import os
from discord.ext import commands
from cogs.utils.embed import passembed
from cogs.utils.embed import errorembed
class Mod(commands.Cog):
def __init__(self, bot):
self.bot = bot
self.case = {}
... | 2.359375 | 2 |
src/main/python/programmingtheiot/cda/sim/TemperatureSensorSimTask.py | Taowyoo/-constrained-device-app | 0 | 12785733 | <reponame>Taowyoo/-constrained-device-app<gh_stars>0
#####
#
# This class is part of the Programming the Internet of Things project.
#
# It is provided as a simple shell to guide the student and assist with
# implementation for the Programming the Internet of Things exercises,
# and designed to be modified by the stu... | 3.28125 | 3 |
attic/gen.py | lojikil/coastML | 6 | 12785734 | <filename>attic/gen.py<gh_stars>1-10
#@(#) lazy person's way of generating a lot of classes:
#@(#) write the code, then grep for returns, then write
#@(#) the classes. This is why I want to make a functional
#@(#) language with ADTs to handle this sort of thing...
#@(#)
#@(#) Usage:
#@(#)
#@(#) `grep 'return Token' boo... | 2.6875 | 3 |
models/prov.py | LvanWissen/saa-bevolkingsregisters | 0 | 12785735 | <filename>models/prov.py
"""
Bio ontology to be used in the enrichment of SAA indices by Golden Agents.
"""
from rdflib import Dataset, Graph, Namespace
from rdflib import XSD, RDF, RDFS, OWL
from rdflib import URIRef, BNode, Literal
from rdfalchemy.rdfSubject import rdfSubject
from rdfalchemy.rdfsSubject import rdf... | 2.328125 | 2 |
test_driven_development/main.py | steph409/snippets_of_code | 0 | 12785736 | <gh_stars>0
import logging
import re
def add(input: str = None) -> str:
'''adds numbers from a string'''
if not isinstance(input, str):
raise TypeError(f"The {input=} is of incorrect type")
logging.info(f"received string value {input}")
if not re.match("^[0-9,\n]*$", input):
raise Valu... | 3.40625 | 3 |
rip/ripping_guide.py | My-Little-Cable-Co/rip | 0 | 12785737 | <filename>rip/ripping_guide.py
import json
from pathlib import Path
from typing import Dict, List, Optional
from jsonschema.validators import validator_for
from ripping_guide_schema import RIPPING_GUIDE_SCHEMA
class Ripable:
def __init__(self, name, disc_title, disc_chapters, file_path):
self.name = nam... | 2.71875 | 3 |
dumbpm/shared/shared.py | poros/dumbpm | 7 | 12785738 | <reponame>poros/dumbpm
from pandas import DataFrame
def compute_stats(duration: list[int]) -> DataFrame:
"""Statistics to visualize for the result of a Monte Carlo simulation."""
return DataFrame(duration, columns=["Duration"]).describe(
percentiles=[0.5, 0.75, 0.90, 0.99]
)
| 2.9375 | 3 |
src/test_acceptance.py | AviBuckman/Vulnerability-Checker | 0 | 12785739 | <gh_stars>0
import pytest
import os
from CSV_handler import CSVHandler, DataHandler
from checker import Checker
import csv
libsrpm = ['dbus-tools-1.12.8-9.el8.x86_64']
libsdpkg = [
{'name': 'accountsservice', 'version': '0.6.45-1ubuntu1', 'architecture': 'amd64'}
]
def test():
data_handler: DataHandler = CSV... | 2.234375 | 2 |
dragnet/dll/models.py | mozilla/dragnet | 1 | 12785740 | from django.db import models
from django.db.models.signals import pre_save
from django.dispatch import receiver
from django.contrib.auth.models import User
import datetime
class File(models.Model):
"""The actual DLL file itself"""
STATUS_UNKNOWN = 'unknown'
STATUS_VALID = 'valid'
STATUS_MALWARE = 'mal... | 2.140625 | 2 |
thiefringer/thiefringer.py | KyuzoM/thiefringer | 0 | 12785741 | <gh_stars>0
#!/usr/bin/env python
'''
ThiefRinger alarm system - Onion Omega specific python package, motion detection, SMS notification.
'''
from __future__ import print_function
import signal
import sys
import os
import argparse
import json
import threading
try:
from Queue import Queue
except (ImportError, ModuleNot... | 2.265625 | 2 |
modules/shared/domain/repository/unit_of_work.py | eduardolujan/hexagonal_architecture_django | 6 | 12785742 | # -*- coding: utf-8 -*-
# from __future__ import annotations
from typing import Optional, TypeVar
from abc import ABC, abstractmethod
UnitOfWork = TypeVar('UnitOfWork', bound='UnitOfWork')
class UnitOfWork(ABC):
"""
Unit of work
"""
@abstractmethod
def commit(self):
"""
Commit ... | 3.34375 | 3 |
RunToolkit/for_str/transform.py | Ijustwantyouhappy/RunToolkit | 0 | 12785743 | <reponame>Ijustwantyouhappy/RunToolkit
# -*- coding: utf-8 -*-
# @Time : 2019/10/4 1:51
# @Author : Run
# @File : transform.py
# @Software : PyCharm
from RunToolkit.for_str import split_to_words
def camel(s: str) -> str:
"""
Converts a string to camelcase.
"""
tmp = ' '.join(split_to_word... | 3.421875 | 3 |
quero/offer/serializers.py | felipewove/quero-listar | 0 | 12785744 | from django.contrib.auth.models import Group, User
from rest_framework import serializers
from .models import Campus, Course, Offer, University
class UserSerializer(serializers.ModelSerializer):
""" Serialization of User model to render as JSON.
The depth is responsible to render/show information of foreign... | 2.5 | 2 |
chap11/Member03.py | ytianjin/GitTest | 0 | 12785745 | <filename>chap11/Member03.py
# 健身房会员类(第三版)
class Member:
"""健身房会员类(第三版)"""
def __init__(self, no: int, name: str, weight: float) -> None:
"""构造函数"""
self.__no = no
self.__name = name
self.__weight = weight
def lose_weight(self, loss: float) -> None:
... | 3.515625 | 4 |
xc/xc7/tests/serdes/generate_tests.py | bl0x/symbiflow-arch-defs | 183 | 12785746 | #!/usr/bin/env python3
"""
Creates the header file for the OSERDES test with the correct configuration
of the DATA_WIDTH and DATA_RATE
"""
import argparse
def main():
parser = argparse.ArgumentParser(description=__doc__)
parser.add_argument(
'--input', required=True, help="Input top file to be gener... | 2.78125 | 3 |
bot/dialogs/phrases.py | sen-den/fcspm-ksu-bot | 1 | 12785747 | """
Any phrases used by bot.
Tips:
Avoid prefix commands as keywords wor different sates: shortest prefix will intercept handling
"""
EDIT_EMOJI = '🖋 '
MAP_EMOJI = '🗺 '
DOC_EMOJI = '🗒 '
BELL_EMOJI = '🔔 '
TICK_EMOJI = '✔️ '
CROSS_EMOJI = '❌ '
SIGN_EMOJI = '❗ '
WEB_EMOJI = '🌐 '
HOW_TO_ORDER_CERTIFICATE = 'Довідк... | 1.8125 | 2 |
src/dcos-migrate.py | Ganasagar/migration-tools-repo | 0 | 12785748 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import re
import sys
from dcos_migrate.cmd import run
if __name__ == '__main__':
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
run()
| 1.710938 | 2 |
python/hackathon/src/parser/name_extractor.py | FISHackathon2020/RAN | 0 | 12785749 | <gh_stars>0
import spacy
from spacy.matcher import Matcher
def extract_name_with_rules(resume_text):
# load pre-trained model
nlp = spacy.load('en_core_web_sm')
# initialize matcher with a vocab
matcher = Matcher(nlp.vocab)
nlp_text = nlp(resume_text)
# First name and Last name are always P... | 3.109375 | 3 |
src/PlayVideo.py | jluckenbaugh2/Deepcut | 1 | 12785750 | """
Modification History:
Date: 3/16/2021
Time: 6:00PM
Description:
Will extract the phonemes from a TextGrid file and change them into
syllables using the ARPABET dictionary. Two functions will be used
to do this process. First function, get_phoneme, will get all of the
... | 3.59375 | 4 |