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 |
|---|---|---|---|---|---|---|
ibm/was_traditional/wsadmin_commands/help_admin_task_commands.py | Eduardo-Olivas/docker-pirate | 0 | 50600 | # WSADMIN SCRIPT TO SHOW USEFUL ADMINTASK COMMANDS AND HELP TOWARDS THEM
# <NAME>
# Command:
# wsadmin.sh -lang jython -f /tmp/test.py
print("***** Showing AdminTask help *****")
print(AdminTask.help())
print("***** Showing AdminTask commands *****")
print(AdminTask.help("-commands"))
print("***** Showing AdminTask ... | 2.59375 | 3 |
lncRNAediting/wsgi.py | chunjie-sam-liu/LNCediting | 0 | 50601 | """
WSGI config for lncRNAediting project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/1.9/howto/deployment/wsgi/
"""
import os
from os.path import join,dirname,abspath
PROJECT_DIR = dirname(dirname(abspath(__... | 1.75 | 2 |
SecuriTree/management/commands/populateSystemData.py | davymaish/django-SecuriTree | 0 | 50602 | import json
from django.core.management.base import BaseCommand
from SecuriTree.models import Door, Area, AccessRule
class Command(BaseCommand):
def add_arguments(self, parser):
parser.add_argument('json_file', type=str)
def handle(self, *args, **options):
with open(options['json_file']) as f... | 2.140625 | 2 |
pysweng/oop.py | lopezpdvn/pysweng | 0 | 50603 | <filename>pysweng/oop.py
def dummy_function(a):
return a
DUMMY_GLOBAL_CONSTANT_0 = 'FOO';
DUMMY_GLOBAL_CONSTANT_1 = 'BAR';
| 2.28125 | 2 |
ptest/test_template_type/main.py | pskelecton/straw | 2 | 50604 | from pstraw import Straw
from dataclasses import dataclass
from datetime import datetime
import os
case_dir = os.path.dirname(os.path.abspath(__file__))
# 实例化straw对象
db = Straw(
DB_DRIVER='mysql', # 必须输入
DB_DATABASE='straw_test', # 必须输入
DB_USER='root', # 必须输入3306, # mysql默认值:3306 , postgres默认值:5432
DB_... | 2.515625 | 3 |
draw/draw_learning_curves.py | gwaxG/robot_ws | 0 | 50605 | <filename>draw/draw_learning_curves.py
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
from drawer import draw
from retriever import retrieve
from processor import process
if __name__ == "__main__":
database = "exp_e2e" # "exp_official_try_1"
colls = [
"des4",
# "asc1", "asc2", "asc3",
... | 2.71875 | 3 |
tests/bancos/test_banco_api_inter.py | erpbrasil/erpbrasil.febraban | 1 | 50606 | <filename>tests/bancos/test_banco_api_inter.py
# -*- coding: utf-8 -*-
import os
import unittest
from erpbrasil.febraban.api.inter import ApiInter
from erpbrasil.febraban.boleto.banco.inter import BancoInter
from .testutils import BoletoTestCase
class TestBancoApiInter(BoletoTestCase):
def setUp(self):
... | 2.3125 | 2 |
Medium/402.RemoveKDigits.py | YuriSpiridonov/LeetCode | 39 | 50607 | '''
Given a non-negative integer num represented as a string,
remove k digits from the number so that the new number
is the smallest possible.
Note:
- The length of num is less than 10002 and will
be ≥ k.
- The given num does not contain any leading zero.
Example:
... | 3.609375 | 4 |
indra/sources/isi/__init__.py | zebulon2/indra | 136 | 50608 | <reponame>zebulon2/indra<filename>indra/sources/isi/__init__.py
"""
This module provides an input interface and processor to the ISI reading
system.
The reader is set up to run within a Docker container.
For the ISI reader to run, set the Docker memory and swap space to the maximum.
"""
from .api import process_text,... | 1.398438 | 1 |
alarms_project/migrations/0003_auto_20190811_2147.py | hussu97/alarmous | 3 | 50609 | # Generated by Django 2.2.4 on 2019-08-11 17:47
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('alarms_project', '0002_auto_20190811_1841'),
]
operations = [
migrations.AlterField(
model_name='alarm',
name='time'... | 1.328125 | 1 |
npe2/manifest/contributions/_icon.py | nclack/npe2 | 1 | 50610 | from typing import Optional
from pydantic import BaseModel
class Icon(BaseModel):
light: Optional[str]
dark: Optional[str]
| 2.046875 | 2 |
pi.py | jeffreywolf/pyday-2015 | 1 | 50611 | <gh_stars>1-10
#! /usr/bin/env python
import argparse
import numpy as np
def getArgs():
parser = argparse.ArgumentParser(
description = "Simulate Pi"
)
parser.add_argument(
"-n",
type = int,
required = True,
help = "Number of random points to draw"
)
return parser.parse_args()
def dist(x,y):
z = np.s... | 3.375 | 3 |
crawl_trulia/__init__.py | MacHu-GWU/crawl_trulia-project | 1 | 50612 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
__version__ = "0.0.4"
__author__ = "<NAME>"
__license__ = "MIT"
__short_description__ = "Trulia Crawler Tool Set"
try:
from .urlencoder import urlencoder as trulia_urlencoder
from .htmlparser import htmlparser as trulia_htmlparser
except ImportError:
pass | 1.265625 | 1 |
scripts/tflite_model_tools/tflite/HardSwishOptions.py | LaudateCorpus1/edgeai-tidl-tools | 15 | 50613 | # automatically generated by the FlatBuffers compiler, do not modify
# namespace: tflite
import flatbuffers
from flatbuffers.compat import import_numpy
np = import_numpy()
class HardSwishOptions(object):
__slots__ = ['_tab']
@classmethod
def GetRootAsHardSwishOptions(cls, buf, offset):
n = flatb... | 2.09375 | 2 |
utils/ffmpeg.py | IntelligentBehaviourUnderstandingGroup/end-to-end-multiview-lipreading | 12 | 50614 | """
module containing functions to use ffprobe to parse video frame info
"""
from __future__ import print_function
import subprocess
import cStringIO
class base_frame(object):
"""
Base Frame from FFProbe
[FRAME]
media_type=video
stream_index=0
key_frame=0
pkt_pts=11745667
pkt_pts_time=... | 2.75 | 3 |
disent/nn/modules.py | nmichlo/disent | 47 | 50615 | # ~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
# MIT License
#
# Copyright (c) 2021 <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 res... | 1.476563 | 1 |
python/setup.py | fengjixuchui/mercury | 0 | 50616 | <reponame>fengjixuchui/mercury<gh_stars>0
"""
65;5802;1c Copyright (c) 2019 Cisco Systems, Inc. All rights reserved.
License at https://github.com/cisco/mercury/blob/master/LICENSE
"""
import sys
import setuptools
from distutils.extension import Extension
def readme():
with open('README.md') as f:
return... | 1.53125 | 2 |
tests/daemon/unit/models/test_id.py | hirakjyoti08/jina | 1 | 50617 | import uuid
import pytest
from pydantic import BaseModel
from daemon.models import DaemonID
VALID_JTYPES = ['jflow', 'jdeployment', 'jpod', 'jworkspace', 'jnetwork']
def test_jtype_only():
for jtype in VALID_JTYPES:
d = DaemonID(jtype)
assert d.jtype == jtype
assert uuid.UUID(d.jid)
de... | 2.359375 | 2 |
api/urls.py | MrEscape54/CRM | 0 | 50618 | from django.urls import path, include
from . import views
from rest_framework.routers import DefaultRouter
router = DefaultRouter()
router.register('accounts', views.AccountViewSet)
router.register('parents', views.ParentAccountViewSet)
router.register('contacts', views.ContactViewSet)
router.register('opportunities... | 1.828125 | 2 |
condominium/migrations/0012_auto_20200715_1550.py | kozlyuk/appart | 0 | 50619 | <reponame>kozlyuk/appart<filename>condominium/migrations/0012_auto_20200715_1550.py
# Generated by Django 3.0.7 on 2020-07-15 15:50
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('condominium', '0011_auto_20200713_1542'),
]
operations = [
... | 1.1875 | 1 |
TDMA_solver.py | Yatharth9607/lid_driven_cavity_python | 0 | 50620 | <filename>TDMA_solver.py
# Matrix solver (TDMA)
# parameters required:
# n: number of unknowns (length of x)
# a: coefficient matrix
# b: RHS/constant array
# return output:
# b: solution array
def solve_TDMA(n, a, b):
# forward substitution
a[0][2] = -a[0][2] / a[0][1]
b[0] = b[0] / a[0][1]
for i i... | 3.46875 | 3 |
profiles/tests.py | ArRosid/djangorestframework-profilesapi | 0 | 50621 | import json
from django.contrib.auth.models import User
from django.urls import reverse
from rest_framework import status
from rest_framework.authtoken.models import Token
from rest_framework.test import APITestCase
from profiles.api import serializers
from . import models
class RegistrationTestCase(APITestCase):
... | 2.34375 | 2 |
core/command.py | nativium/nativium | 5 | 50622 | <reponame>nativium/nativium
import glob
import importlib
import os
from collections import OrderedDict
nativium_command_list = OrderedDict()
# -----------------------------------------------------------------------------
def get_all_commands(proj_path, args):
# search on project path
project_command_path = o... | 2.5 | 2 |
2015-02/opcode0x90/day2.py | opcode0x90/adventofcode | 3 | 50623 | #!/usr/bin/env python3
# %%
import logging
import itertools
def part1(data):
orders = [(int(d) for d in line.split('x')) for line in data.splitlines()
if line.strip()]
total = 0
for l, w, h in orders:
area = (2 * l * w) + (2 * w * h) + (2 * h * l)
slack = min(a * b for a, b ... | 3.390625 | 3 |
MetaScreener/external_sw/mgltools/MGLToolsPckgs/Support/version.py | bio-hpc/metascreener | 8 | 50624 | __version__ = 'latest'
| 1.039063 | 1 |
dnnMain.py | SilverIceKey/opencvDemo | 0 | 50625 | <reponame>SilverIceKey/opencvDemo
import cv2
isClose = False
# cap = cv2.VideoCapture(0)
modelFile = "opencv_face_detector_uint8.pb"
configFile = "opencv_face_detector.pbtxt"
tensorflowNet = cv2.dnn.readNetFromTensorflow(modelFile, configFile)
# Input image
img = cv2.imread('1.jpg')
noDelImg = cv2.imread('1.jpg')
rows... | 3.09375 | 3 |
openbook_auth/apps.py | TamaraAbells/okuna-api | 164 | 50626 | from django.apps import AppConfig
class OpenbookAuthConfig(AppConfig):
name = 'openbook_auth'
| 1.078125 | 1 |
lightbus/api.py | gcollard/lightbus | 178 | 50627 | from typing import Dict
from lightbus.exceptions import (
UnknownApi,
InvalidApiRegistryEntry,
EventNotFound,
MisconfiguredApiOptions,
InvalidApiEventConfiguration,
)
__all__ = ["Api", "Event"]
class ApiRegistry:
def __init__(self):
self._apis: Dict[str, Api] = dict()
def add(s... | 2.6875 | 3 |
base/forms.py | vishnusayanth/django-app | 0 | 50628 | from django import forms
from base.models import Developer
class RegistrationForm(forms.ModelForm):
password = forms.CharField(widget=forms.PasswordInput())
password2 = forms.CharField(widget=forms.PasswordInput())
class Meta:
model = Developer
fields = 'username', 'password', '<PASSWORD... | 2.234375 | 2 |
aioscrapy/core/scheduler/queue.py | conlin-huang/aio-scrapy | 13 | 50629 | import logging
from aioscrapy.utils.reqser import request_to_dict, request_from_dict
from .serializ import PickleCompat
logger = logging.getLogger(__name__)
_to_str = lambda x: x if isinstance(x, str) else str(x)
class Base(object):
"""Per-spider base queue class"""
def __init__(self, serve... | 2.390625 | 2 |
timers_test/tick/serial_client.py | victorlaskurain/unaibot | 0 | 50630 | #!/usr/bin/python
import serial
import sys
import time
def main():
while True:
ser = serial.Serial('/dev/ttyACM0', 9600, timeout=5000)
last_time = time.time()
while True:
tag = ser.readline().strip()
new_time = time.time()
print('%s %s'%(tag, new_time - ... | 2.671875 | 3 |
py/instalog/plugins/output_archive_unittest.py | arccode/factory | 3 | 50631 | #!/usr/bin/env python3
#
# Copyright 2017 The Chromium OS Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Unittests for output archive plugin."""
import copy
import glob
import logging
import os
import resource
import shutil
import... | 2 | 2 |
pydata/submodule/submodule.py | nguyentu1602/pyexp | 0 | 50632 | import json
import datetime as dt
import platform
from ..pydata_lib import test_glob # example of relative import
def print_machine_stats():
try:
from ..pydata_lib import test_glob
except RuntimeError:
print('relative import failed')
print(dt.datetime.now())
print(platform.version())
... | 2.15625 | 2 |
backend/movies/migrations/0002_omdb_viewset.py | gelmiro/movies | 0 | 50633 | <filename>backend/movies/migrations/0002_omdb_viewset.py
# Generated by Django 3.1.2 on 2020-10-09 10:01
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('movies', '0001_initial'),
]
operations = [
migrations.RenameField(
model_name='... | 1.742188 | 2 |
utils/camera.py | oktomus/blender_gamepad_controls | 2 | 50634 | <reponame>oktomus/blender_gamepad_controls<filename>utils/camera.py
import bpy
def get_selected_camera():
"""Return the selected camera."""
selected_objects = bpy.context.selected_objects
# None will be returned if nothing match
return next((obj for obj in selected_objects if obj.type == 'C... | 2.6875 | 3 |
tests/register_test.py | ClementWalter/pandas-addons | 2 | 50635 | import itertools
from unittest.mock import patch
import pytest
from pandas_addons.register import DEFAULT_PANDAS_OBJECTS, accessors, register
class TestRegister:
def test_should_return_input_function(self):
def accessor():
pass
assert accessor == register()(accessor)
@patch.dic... | 2.46875 | 2 |
tests/recipe/test_diff.py | telia-oss/birgitta | 8 | 50636 | <reponame>telia-oss/birgitta
import inspect
import os
import pytest
from birgitta.recipe import diff, find
from newsltd_etl import projects
@pytest.fixture()
def projects_path():
return os.path.dirname(inspect.getfile(projects))
def test_diff(projects_path):
recipe_content = find.recipe_content(
pr... | 2.140625 | 2 |
ESMF/src/addon/ESMPy/src/ESMF/util/cache_data.py | joeylamcy/gchp | 1 | 50637 | import os
DATA_URL_ROOT = 'http://www.earthsystemmodeling.org/download/data'
# If fname doesn't exist, retrieve it from the remote server via http.
def cache_data_file(fname, DATA_URL_ROOT=DATA_URL_ROOT):
import sys
if sys.version_info[0] >= 3:
from urllib.request import urlopen, URLError
else:
... | 3.046875 | 3 |
app/main/error.py | Waithera-m/partage | 0 | 50638 | <filename>app/main/error.py
from flask import render_template
from . import main
@main.app_errorhandler(404)
def lost_not_found(error):
'''
Function renders 404 page if user enters and invalid url
'''
return render_template('error.html'),404 | 2.625 | 3 |
cpp/test_filter.py | streamcorpus/streamcorpus-filter | 1 | 50639 | <filename>cpp/test_filter.py<gh_stars>1-10
#!/usr/bin/env python
"""
Achieve this:
xz -d < ../data/nametesttexts.sc.xz | (./filter-multifast --normalize --names=../data/dumbnames.txt 2> /tmp/${USER}_filterlog.txt) | xz > /tmp/${USER}_filter.sc.xz
or
--names-scf=../data/test-name-strings.scf
check that certain log ... | 2.234375 | 2 |
hedgedata/backfill.py | jay-johnson/hedgedata | 0 | 50640 | import pyEX as p
from datetime import timedelta
from functools import lru_cache
from .utils import last_month, last_close
from .fetch import fetch, \
fetchStats as backfillStats, \
fetchPeers as backfillPeers, \
fetchNews as backfillNews, \
fet... | 2.328125 | 2 |
src/polyswarm/formatters/text.py | polyswarm/polyswarm-cli | 2 | 50641 | from __future__ import absolute_import, unicode_literals
import sys
import functools
import json
import click
from polyswarm.formatters import base
def is_grouped(fn):
@functools.wraps(fn)
def wrapper(self, text):
return self._depth*'\t'+fn(self, text)
return wrapper
class TextOutput(base.Bas... | 2.1875 | 2 |
src/paper/migrations/0070_paper_is_removed_by_user.py | ResearchHub/ResearchHub-Backend-Open | 18 | 50642 | # Generated by Django 2.2 on 2020-11-19 20:46
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('paper', '0069_remove_paper_sift_risk_score'),
]
operations = [
migrations.AddField(
model_name='paper',
name='is_remov... | 1.65625 | 2 |
download_attachment.py | tczhao/confluence-dumper | 0 | 50643 | import pickle
from multiprocessing.pool import ThreadPool as Pool
import utils
with open('file.pkl', 'rb') as file:
myvar = pickle.load(file)
print(len(myvar["GLOBAL_absolute_download_url"]))
def download(absolute_download_url, downloaded_file_path, auth, headers, verify_peer_certificate, proxies):
try:
... | 2.59375 | 3 |
branding/migrations/0002_foreign_relationships.py | everyvoter/everyvoter | 5 | 50644 | <reponame>everyvoter/everyvoter
# -*- coding: utf-8 -*-
# Generated by Django 1.11.12 on 2018-04-30 16:43
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('election', '0001_initial'),
('branding', '0001_init... | 1.585938 | 2 |
iCallSV/sortbamByCoordinate.py | rhshah/iCallSV | 20 | 50645 | <reponame>rhshah/iCallSV<gh_stars>10-100
"""
sortbamByCoordinate
~~~~~~~~~~~~~~~~~~~
:Description: This module will sort bam file by coordinate
"""
'''
Created on Mar 19, 2015
Description: This module will sort bam file by coordinate
@author: <NAME>
'''
import os
import sys
import pysam
import logging
import coloredl... | 2.5 | 2 |
Desafio063.py | MarcioRSanches/Estudos_Python | 0 | 50646 | n = int(input('Quantos termos [FIBONACCI], você quer mostrar? '))
ant = 0
post = 1
cont = 0
print('{} -> {}'.format(ant, post),end='')
while cont <= n:
atual = ant + post
print( '-> {}'.format(atual),end='')
ant = post
post = atual
cont += 1
print('-> FIM!')
| 3.859375 | 4 |
lupa/tests/fixtures/osmapi.py | MinisterioPublicoRJ/api-cadg | 6 | 50647 | <reponame>MinisterioPublicoRJ/api-cadg<filename>lupa/tests/fixtures/osmapi.py
default_response = {
"features":[
{
"geometry":{
"coordinates":[
-43.21986610772104,
-22.8049732
],
"type":"Point"
},
"type":"Feature",
... | 1.414063 | 1 |
day2/solution.py | JackMc/advent_of_code | 0 | 50648 | <filename>day2/solution.py<gh_stars>0
from collections import Counter
def has_three_letters(str):
c = Counter(str)
return len([k for k in c if c[k] == 3]) > 0
def has_two_letters(str):
c = Counter(str)
return len([k for k in c if c[k] == 2]) > 0
two_counter = 0
three_counter = 0
with open('input.txt... | 3.859375 | 4 |
Python_MD_toHTML/Marked.py | StevenDias33/Marked | 1 | 50649 | import markdown2
import re
import os
from os.path import splitext
link_patterns = [(re.compile(
r'((([A-Za-z]{3,9}:(?:\/\/)?)(?:[\-;:&=\+\$,\w]+@)?[A-Za-z0-9\.\-]+(:[0-9]+)?|(?:www\.|[\-;:&=\+\$,\w]+@)[A-Za-z0-9\.\-]+)((?:\/[\+~%\/\.\w\-_]*)?\??(?:[\-\+=&;%@\.\w_]*)#?(?:[\.\!\/\\\w]*))?)'), r'\1')]
head = "<!DOC... | 2.9375 | 3 |
worldtradingdata/public/constants.py | staneslevski/WorldTradingDataPythonSDK | 12 | 50650 | <gh_stars>10-100
allowed_request_categories = [
'stock',
'mutual_fund',
'intraday',
'history',
'history_multi_single_day',
'forex',
'forex_history',
'forex_single_day',
'stock_search'
]
| 1.15625 | 1 |
nn.py | Radu-Raicea/Pokemon-Type-AI | 2 | 50651 |
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.autograd as autograd
import torch.optim as optim
import pre_process as pp
inputs, outputs = pp.get_data()
class Model(nn.Module):
def __init__(self):
super(Model, self).__init__()
self.layer1 = nn.Linear(6, 6)
... | 2.75 | 3 |
FastDetector/MobiNetV3_test.py | Yoshi-E/Object-Localizer-Project | 0 | 50652 | from models import MobiNetV3
from models.Core import Config
import os
from glob import glob
config = Config()
model = MobiNetV3.FastModel(config)
config.WEIGHTS_FILE = "weights/MobiNetV3/weight-0.73.h5"
if __name__ == "__main__":
#model.test_image("FastDetector/datasets/10_rosbag/images/1565608339175915704.jpg")
... | 1.804688 | 2 |
static/const.py | MKuranowski/WarsawGTFS | 20 | 50653 | <filename>static/const.py
"""
Constant values used all over the place.
Fare data is stored in fares/data.py.
"""
# Directories
DIR_DOWNLOAD = "data_src"
DIR_CONVERTED = "data_feeds"
DIR_SINGLE_FEED = "data_gtfs"
DIR_SHAPE_ERR = "err_shapes"
DIR_SHAPE_CACHE = "data_shapes"
# How long to keep Overpass data cached (in ... | 1.726563 | 2 |
examples/drawing/sample13_gamma_and_colorspace1.py | chromia/wandplus | 0 | 50654 | #!/usr/bin/env python
from wand.image import Image
from wand.drawing import Drawing
from wand.color import Color
# http://www.imagemagick.org/Usage/draw/#colorspace
# original imagemagick command:
# convert -size 81x81 xc:black -fill white -draw 'circle 40,40 40,3' \
# circle_raw.png
#
# convert -size 81x81 ... | 3.03125 | 3 |
tm1637.py | neptune46/PiWeather | 0 | 50655 | <reponame>neptune46/PiWeather<gh_stars>0
#!/usr/bin/env python
# encoding: utf-8
import RPi.GPIO as GPIO
import time
CLK1 = 11
DIO1 = 12
CLK2 = 13
DIO2 = 15
CLK3 = 16
DIO3 = 18
"""
A
---
F | | B
-G-
E | | C
---
D
"""
digital_coding = {
'0': 0x3f,
... | 2.328125 | 2 |
milkviz/_dot.py | Mr-Milk/milkviz | 0 | 50656 | <filename>milkviz/_dot.py
from typing import Optional, List, Union, Tuple, Any
import matplotlib as mpl
import matplotlib.axes
import matplotlib.pyplot as plt
import numpy as np
from milkviz.utils import adaptive_figsize, norm_arr, doc, set_size_legend, set_spines, set_ticks
def set_dot_grid(data,
... | 2.515625 | 3 |
cryptol-remote-api/python/tests/cryptol/test_basics.py | GaloisInc/cryptol | 773 | 50657 | import unittest
from argo_client.interaction import ArgoException
from pathlib import Path
import unittest
import io
import os
import time
import cryptol
import cryptol.cryptoltypes
from cryptol.single_connection import *
from cryptol.bitvector import BV
from BitVector import * #type: ignore
# Tests of the core serve... | 2.390625 | 2 |
go/A005-del-manually-selected-obsolete-go-entities.py | rwst/wikidata-molbio | 2 | 50658 | <reponame>rwst/wikidata-molbio
import pronto, six, csv, os, json, argparse, sys, datetime
"""
Uses eyeballed A004.txt. Cleans and moves all items chunkwise (CHUNKSIZE).
"""
CHUNKSIZE = 10
# Initiate the parser
parser = argparse.ArgumentParser()
# Read arguments from the command line
args = parser.parse_args()
# Che... | 2.359375 | 2 |
test/ackermann/test_local_ackermann_recursive.py | inesucrvenom/mathfun | 0 | 50659 | import unittest
from src.lambda_ackermann_recursive import ackermann
import test.ackermann.basetests_ackermann as BT
def call_function(a: int, b: int) -> int:
return ackermann(a, b)
class Test_ValidInput(unittest.TestCase, BT.ValidInput):
def base_function(self, a, b):
return call_function(a, b)
c... | 3.40625 | 3 |
AlphanumericCharacterDetection/alphanum_B.py | RobEn-AAST/AI-UAVC | 16 | 50660 | '''
objective :-
------------
detect and classify shapes and their location in an image with low latency and high accuracy.
it must account for false positives and empty images.
modules used :-
---------------
1 - open cv for image processing tasks.
2 - easyocr for text-recognition tasks.
3 - threading for running tex... | 3.5625 | 4 |
opps/articles/search_indexes.py | jeanmask/opps | 159 | 50661 | # -*- coding: utf-8 -*-
from datetime import datetime
from django.conf import settings
from haystack.indexes import Indexable
from opps.containers.search_indexes import ContainerIndex
from .models import Post, Album, Link
migration_date = getattr(settings, 'MIGRATION_DATE', None)
if migration_date:
m_date = ... | 2.25 | 2 |
src/openprocurement/framework/electroniccatalogue/tests/document.py | ProzorroUKR/openprocurement.api | 10 | 50662 | <filename>src/openprocurement/framework/electroniccatalogue/tests/document.py
# -*- coding: utf-8 -*-
import unittest
from copy import deepcopy
from openprocurement.api.tests.base import snitch
from openprocurement.framework.electroniccatalogue.tests.base import (
test_electronicCatalogue_data,
test_electronic... | 2.28125 | 2 |
pychron/hardware/core/communicators/modbustcp_communicator.py | ASUPychron/pychron | 31 | 50663 | <reponame>ASUPychron/pychron
# ===============================================================================
# Copyright 2021 ross
#
# 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:/... | 2.203125 | 2 |
Aula6/Menor.py | Anderson842/LabADAGrupoC | 0 | 50664 | <filename>Aula6/Menor.py
#Encontrar el menor valor en un array
#con busqueda binaria
def menor (array):
l=0
r=len(array)-1
while l<=r:
mid = l+(r-l)//2
if array[mid] > array[r]:
l=mid+1
if array[mid]< array[r]:
r=mid
if r==l or mid==0:
ret... | 3.828125 | 4 |
Only_one_Step/topol_POSRES_lig_cof.py | lbfederico/gmx_scripts | 2 | 50665 | <reponame>lbfederico/gmx_scripts
import sys
def get_line(txt):
file = open('topol.top', encoding='utf8')
for line_num, value in enumerate(file, 1):
if txt in value:
return line_num
if len(sys.argv) < 3:
print('ERROR: put lig and cof names wi... | 2.46875 | 2 |
code/print_dice.py | hanouticelina/dice-battle | 0 | 50666 | from random import randrange
red = '\x1b[31;6m'
bold = '\x1b[;1m'
blue = '\x1b[34;6m'
green = '\x1b[32;6m'
def get_single_dice_face(dice_roll, eye='o '):
"""Permet de dessiner une face d'un dés"""
print(red)
r = dice_roll - 1
dice_str = '+-----+\n| {0} {1} |\n| {2}'.format(eye[r<1], eye[r<3], eye[r<5])... | 3.421875 | 3 |
app/annohub/lib/db.py | inktrap/annohub | 0 | 50667 | <reponame>inktrap/annohub<gh_stars>0
# -*- coding: utf-8 -*-
# vim: tabstop=8 expandtab shiftwidth=4 softtabstop=4
from annohub import app
import annohub.lib.user as user
import annohub.lib.license as license
import annohub.lib.language as language
import annohub.lib.genre as genre
import annohub.lib.tagset as tagset
... | 2.125 | 2 |
platform/radio/efr32_multiphy_configurator/pyradioconfig/parts/common/calculators/calc_misc.py | PascalGuenther/gecko_sdk | 82 | 50668 | """Core CALC_Misc Package
Calculator functions are pulled by using their names.
Calculator functions must start with "calc_", if they are to be consumed by the framework.
Or they should be returned by overriding the function:
def getCalculationList(self):
"""
import inspect
from pyradioconfig.calculator_m... | 2.828125 | 3 |
gbe/views/functions.py | bethlakshmi/gbe-divio-djangocms-python2.7 | 1 | 50669 | from gbe.forms import ParticipantForm
from django.forms import (
ChoiceField,
MultipleChoiceField,
)
from gbe_forms_text import (
how_heard_options,
participant_labels,
)
from gbetext import (
act_casting_label,
states_options,
)
from scheduler.idd import get_occurrences
from gbe.models import S... | 1.90625 | 2 |
yg/lockfile/py33compat.py | yougov/yg.lockfile | 1 | 50670 | <gh_stars>1-10
import functools
import contextlib
try:
suppress_file_not_found = functools.partial(
contextlib.suppress,
FileNotFoundError, # noqa: F821
)
except Exception:
# Python 3.3 doesn't have contextlib.suppress
# nor FileNotFoundError.
import contextlib2
suppress_file_not_found = functools.partial(... | 2.359375 | 2 |
tests/glm/distribution/util.py | strongio/foundry | 0 | 50671 | <gh_stars>0
import torch
from tests.util import assert_tensors_equal
def assert_dist_equal(x: torch.distributions.Distribution, y: torch.distributions.Distribution, tol: float = .001):
assert x.arg_constraints == y.arg_constraints
for nm in x.arg_constraints:
x_attr = getattr(x, nm)
if isinst... | 2.4375 | 2 |
loss_functions.py | lizeqian/Compositional-embedding-models-for-speaker-identification-and-diarization-with-simultaneous-speech | 0 | 50672 | <filename>loss_functions.py
import torch
import torch.nn as nn
import torch.nn.functional as F
import math
class AngularPenaltySMLoss(nn.Module):
def __init__(self, in_features, out_features, g_net, loss_type='arcface', eps=1e-7, s=None, m=None):
'''
Angular Penalty Softmax Loss
Three 'l... | 2.296875 | 2 |
CodeChef_problems/expected_change.py | ajeet1308/code_problems | 61 | 50673 | <reponame>ajeet1308/code_problems
def fun(s):
ans = 0
o = 0
c = 0
for i in s:
if(i=="("):
o+=1
elif(i==")"):
c+=1
if(c>o):
c-=1
o+=1
ans+=1
return ans
t = int(input())
for _ in range(t):
n = int(input())
s = input()
ans = 0
N = 10**9+7
value = ((n+1)*n)//2... | 3.109375 | 3 |
src/ctc/protocols/fei_utils/analytics/metric_groups/buyback_metrics.py | fei-protocol/checkthechain | 94 | 50674 | from __future__ import annotations
import typing
from ctc import spec
from ctc.protocols import balancer_utils
from .. import analytics_spec
async def async_compute_buybacks(
blocks: list[int], verbose: bool = False
) -> analytics_spec.MetricGroup:
return {
'name': 'Buybacks',
'metrics': {... | 2.15625 | 2 |
tests/test_cases/test_array_simple/test_array_simple.py | lavanyajagan/cocotb | 350 | 50675 | <filename>tests/test_cases/test_array_simple/test_array_simple.py
# Copyright cocotb contributors
# Licensed under the Revised BSD License, see LICENSE for details.
# SPDX-License-Identifier: BSD-3-Clause
"""Test getting and setting values of arrays"""
import contextlib
import logging
import cocotb
from cocotb.clock i... | 2.15625 | 2 |
backend/durhack/cameras/admin.py | OhmGeek/Durhack | 0 | 50676 | from django.contrib import admin
from cameras.models import Camera
# Register your models here.
admin.site.register(Camera)
| 1.296875 | 1 |
example/city.py | MichaelSchneeberger/dataclass-abc | 9 | 50677 | from abc import ABC
from example.mixins.citynamemixin import CityNameMixin
from example.mixins.spherepositionmixin import SpherePositionMixin
class City(CityNameMixin, SpherePositionMixin, ABC):
pass
| 2.078125 | 2 |
trainers/uts_regression_trainer.py | Neronjust2017/keras-project | 2 | 50678 | <reponame>Neronjust2017/keras-project<filename>trainers/uts_regression_trainer.py
# -*- coding: UTF-8 -*-
from base.base_trainer import BaseTrain
import os
from keras.callbacks import ModelCheckpoint, TensorBoard, EarlyStopping
from utils.uts_regression.tools import AdvancedLearnignRateScheduler
class UtsRegressionMod... | 1.984375 | 2 |
L4:CV_CreateWindow_Function_part3/4.3.py | animeshsrivastava24/OPEN_CV | 9 | 50679 | <reponame>animeshsrivastava24/OPEN_CV
"""Here we will create a window whose size can be controlled and changed, if we specify flag to be cv2.WINDOW_NORMAL, you can resize window. It will be
helpful when image is too large in dimension and adding track bar to windows."""
import numpy as np
import cv2
a=cv2.imread('/home... | 3.234375 | 3 |
pydgilib/dgilib_discovery.py | martinabr/pydgilib | 2 | 50680 | """This module provides Python bindings for the Discovery API of DGILib."""
from ctypes import byref, create_string_buffer
from pydgilib.dgilib_config import GET_STRING_SIZE
from pydgilib.dgilib_exceptions import DeviceReturnError
class DGILibDiscovery(object):
"""Python bindings for DGILib Discovery.
DGIL... | 2.296875 | 2 |
projects/mq_handler/sync_mq_handler/purchase_order_close_sync.py | kingking888/crawler-pyspider | 1 | 50681 | <reponame>kingking888/crawler-pyspider
import json
import traceback
from alarm.config import HUPUN_SYNC_ABNORMAL_ROBOT
from alarm.helper import Helper
from alarm.page.ding_talk import DingTalk
from cookie.config import ROBOT_TOKEN
from hupun.config import HUPUN_SEARCH_DAYS
from hupun.page.purchase_order_goods import Pu... | 2.046875 | 2 |
CV/Effective Transformer-based Solution for RSNA Intracranial Hemorrhage Detection/easymia/trainer/evaluator.py | dumpmemory/Research | 0 | 50682 | <gh_stars>0
# -*- coding: UTF-8 -*-
################################################################################
#
# Copyright (c) 2022 Baidu.com, Inc. All Rights Reserved
#
################################################################################
"""
评估/推理器
"""
import os
import numbers
import time
import s... | 1.992188 | 2 |
cblib/scripts/dist/INTEGER.py | HFriberg/cblib-base | 3 | 50683 | import math
def primdist(x):
return max([abs(xj - math.floor(xj + 0.5)) for xj in x])
| 2.359375 | 2 |
newsfeed/users/tests/test_urls.py | mccarrion/newsfeed-django | 2 | 50684 | <reponame>mccarrion/newsfeed-django
from django.urls import include, path, reverse
from rest_framework import status
from rest_framework.test import APITestCase, URLPatternsTestCase
class ArticleUrlTests(APITestCase, URLPatternsTestCase):
urlpatterns = [
path('api/', include('newsfeed.users.urls')),
]... | 2.59375 | 3 |
mujoco_maze/custom_expert_maze_task.py | jypark0/mujoco-maze | 0 | 50685 | """
Custom added maze tasks with dense rewards and progressively farther goals
For creating expert demonstrations
"""
from typing import Dict, List, Type, Tuple
import numpy as np
from mujoco_maze.custom_maze_task import (
GoalRewardLargeUMaze,
GoalRewardRoom3x5,
GoalRewardRoom3x10,
)
from mujoco_maze.t... | 2.46875 | 2 |
acmicpc/9536.py | juseongkr/BOJ | 7 | 50686 | for _ in range(int(input())):
s = set()
n = input().split()
while True:
m = input().split()
if m[-1] == "say?":
break
s.add(m[-1])
for i in n:
if i not in s:
print(i, end=' ')
print()
| 3.609375 | 4 |
M2_Big_Data_Modeling_and_Management_Systems/big-data-2/sensor/stream-data.py | cmaroblesg/Big_Data | 21 | 50687 | <filename>M2_Big_Data_Modeling_and_Management_Systems/big-data-2/sensor/stream-data.py
#!/usr/bin/python
import socket
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect(('rtd.hpwren.ucsd.edu', 12020))
for i in range(0, 60):
d = s.recv(1024)
p = d.split('\t', 2)
print "{0}: {1}".format(i, p[2... | 2.640625 | 3 |
openrl/algorithms/cql/cql.py | natetsang/open-rl | 2 | 50688 | <filename>openrl/algorithms/cql/cql.py
"""
Conservative Q-Learning (CQL)
TODO:
> Fix plotting
> Instead of online_epochs, be able to change the number of steps
> Fix the target weight updates so they work without poly_ak
>
"""
import gym
import time
import argparse
import numpy as np
import tensorflow... | 1.976563 | 2 |
recipes/Python/577810_Named_Values/recipe-577810.py | tdiprima/code | 2,023 | 50689 | class NamedValue:
# defining __slots__ in a mixin doesn't play nicely with builtin types
# so a low overhead approach would have to use collections.namedtuple
# style templated code generation
def __new__(cls, *args, **kwds):
name, *args = args
self = super().__new__(cls, *args, **kwds)
... | 2.875 | 3 |
config.py | st084331/glebzaytcevchatbot | 0 | 50690 | # -*- coding: utf-8 -*-
BOT_TOKEN = "<KEY>"
# Задержка перед ответом бота в секундах.
RESPONSE_DELAY = 3
# Шанс ответа в процентах (от 1 до 100).
RESPONSE_CHANCE = 25
| 1.546875 | 2 |
solvers/brick_heads/instructions/instruction_generator.py | Anthony102899/Lego-ImageGenerator | 1 | 50691 | <filename>solvers/brick_heads/instructions/instruction_generator.py
from bricks_modeling.bricks.model import Model
from bricks_modeling.file_IO.util import to_ldr_format
def write_model_to_file(model: Model, file_path):
file = open(file_path, "a")
ldr_content = ""
for group_name in model.group_names:
... | 2.6875 | 3 |
tron/Hub/Reply/Encoders/RawReplyEncoder.py | sdss/tron | 0 | 50692 | <reponame>sdss/tron
__all__ = ['RawReplyEncoder']
from tron import Misc
from tron.Hub.KV.KVDict import kvAsASCII
from tron.Parsing.dequote import dequote
from .ReplyEncoder import ReplyEncoder
class RawReplyEncoder(ReplyEncoder):
""" Encode Replys without any protocol information.
Options:
EOL -... | 2.328125 | 2 |
server.py | simonbru/mumble-online-indicator | 1 | 50693 | #!/usr/bin/env python3
import argparse
import json
import logging
import socket
import socketserver
import time
from collections import deque
from queue import Queue
from threading import Thread
import Ice
logger = logging.getLogger(__name__)
def retrieve_server_state():
try:
import mice3 as mice
... | 2.265625 | 2 |
5. Image Arithmetic and Logic/face-5.py | jalayrupera/opencvBasics | 0 | 50694 | import cv2
import numpy as np
img1 = cv2.imread('3D-Matplotlib.png')
img2 = cv2.imread('mainlogo.png')
# THREE DIFFERENT WAYS OF ADDING TWO PICTURE
#1
#add = img1+ img2
#2
#img = cv2.add(img1,img2) # USING BUILT IN FUNCTION OF CV2 TO ADD TWO IMAGES
#3
#weighted_add = cv2.addWeighted(img1, 0.6, img2,... | 3.484375 | 3 |
tests/functions/test_update_model.py | kritchie/LIBiFBTSVM | 3 | 50695 | <reponame>kritchie/LIBiFBTSVM
import pytest
import numpy as np
from libifbtsvm import iFBTSVM, Hyperparameters
def test_compute_score_none():
params = Hyperparameters(phi=0.5)
svm = iFBTSVM(parameters=params)
score = None
c = np.zeros((5,))
for i in range(5):
c[i] = i + 1
_score =... | 2.046875 | 2 |
paper/experiments/experiments_appG2.py | flxst/nerblackbox | 0 | 50696 | from typing import Optional, Dict, List, Any
from itertools import product
from paper.experiments.global_variables import TRAINING_DATASET_FRACTIONS
########################################################################################################################
# 3. APP.G.2 (Variants: Cool-down epochs)
######... | 2.3125 | 2 |
userscripts/LabelSeeder/LabelSeeder.py | majora2007/torrent-interface | 1 | 50697 | '''
@name LabelSeeder.py
@author <NAME>
@description Stop seeding any freshly completed torrent without correct label.
'''
import httplib
import json
context = httplib.HTTPConnection('localhost', 5000)
# Get information about torrent
context.request('POST', '/getTorrent', '{}')
torrent = json.loads(context.getresp... | 2.59375 | 3 |
gist_magic/extensions/gist.py | timbr-io/gist-magic | 3 | 50698 | <gh_stars>1-10
from IPython.core.magic import (Magics, magics_class, line_magic,
cell_magic, line_cell_magic)
from IPython import get_ipython
import argparse
from pygithub3 import Github
from pygithub3.resources.gists import Gist
import os
import shlex
from itertools import chain
from... | 2.484375 | 2 |
sdk/python/pulumi_aws/lambda_/layer_version_permission.py | chivandikwa/pulumi-aws | 0 | 50699 | <filename>sdk/python/pulumi_aws/lambda_/layer_version_permission.py
# coding=utf-8
# *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
import warnings
import pulumi
import pulumi.runtime
from typing imp... | 1.882813 | 2 |