max_stars_repo_path stringlengths 3 269 | max_stars_repo_name stringlengths 4 119 | max_stars_count int64 0 191k | id stringlengths 1 7 | content stringlengths 6 1.05M | score float64 0.23 5.13 | int_score int64 0 5 |
|---|---|---|---|---|---|---|
tests/test_audit.py | benjaminp/grouper | 0 | 12769551 | <reponame>benjaminp/grouper<filename>tests/test_audit.py<gh_stars>0
from collections import namedtuple
from datetime import datetime, timedelta
from urllib import urlencode
import pytest
from fixtures import standard_graph, graph, users, groups, session, permissions # noqa
from fixtures import fe_app as app # noqa
... | 2.171875 | 2 |
packages/main/src/RPA/scripts/google_authenticate.py | ete99/rpaframework | 0 | 12769552 | import argparse
import base64
import os
import pickle
from google_auth_oauthlib.flow import InstalledAppFlow
SERVICE_SCOPES = {
"drive": ["drive.appdata", "drive.file", "drive.install", "drive"],
"apps-script": ["script.projects"],
}
def get_arguments(parser):
parser.add_argument(
"--credentials... | 2.96875 | 3 |
rmPython.py | emiliska/unix-commands-python3 | 0 | 12769553 | <gh_stars>0
import sys, os
# How to use:
# python .\mvPython.py '.\mvPython.py' 'D:\USERNAME\DESTINATION_FOLDER...'
for arg in sys.argv[1:]: # loop through arguments from command line
os.remove(arg)
| 2.171875 | 2 |
AutotestWebD/apps/myadmin/service/UserService.py | yangjourney/sosotest | 422 | 12769554 | import apps.common.func.InitDjango
from all_models.models import TbUser, TbAdminUserPermissionRelation
from apps.common.func.WebFunc import *
class UserService(object):
@staticmethod
def getUsers():
return TbUser.objects.all()
@staticmethod
def getUserByLoginname(loginname):
return ... | 1.945313 | 2 |
root/ilikeit/RabbitMQCrashCourse/tutorials/workqueues/new_task_durability.py | ChyiYaqing/chyidlTutorial | 5 | 12769555 | <filename>root/ilikeit/RabbitMQCrashCourse/tutorials/workqueues/new_task_durability.py
#!/usr/bin/env python3
# -*- coding:utf-8 -*-
"""
new_task.py to allow arbitrary messages to be sent from the command line. This program will schedule tasks to our work queue.
The main idea behind Work Queues is to avoid doing a res... | 2.9375 | 3 |
image_projection.py | rhLahr/CNN_coffee_ring_effect | 0 | 12769556 | import numpy as np
from PIL import Image
import torch
import torch.nn as nn
from load_test_data import load_test_data
from sklearn.metrics import confusion_matrix
from model_result import model_result
import matplotlib.pyplot as plt
import seaborn as sn
import pandas as pd
import pickle
import os
import mat... | 3.0625 | 3 |
base_solver/pytorch-captcha-recognition/my_dataset.py | johnnyzn/DW-GAN | 109 | 12769557 | <gh_stars>100-1000
# -*- coding: UTF-8 -*-
import os
from torch.utils.data import DataLoader,Dataset
import torchvision.transforms as transforms
from PIL import Image
import one_hot_encoding as ohe
import captcha_setting
import numpy as np
import cv2
class mydataset(Dataset):
def __init__(self, folder, folder_2 = ... | 2.546875 | 3 |
dfvfs/resolver_helpers/cpio_resolver_helper.py | dfrc-korea/dfvfs | 1 | 12769558 | # -*- coding: utf-8 -*-
"""The CPIO path specification resolver helper implementation."""
from dfvfs.file_io import cpio_file_io
from dfvfs.lib import definitions
from dfvfs.resolver_helpers import manager
from dfvfs.resolver_helpers import resolver_helper
from dfvfs.vfs import cpio_file_system
class CPIOResolverHel... | 2.03125 | 2 |
stacker/hooks/route53.py | chrishenry/stacker | 0 | 12769559 | <reponame>chrishenry/stacker
import logging
logger = logging.getLogger(__name__)
from boto.route53 import connect_to_region
from stacker.util import create_route53_zone
def create_domain(region, namespace, mappings, parameters, **kwargs):
conn = connect_to_region(region)
domain = kwargs.get('domain', param... | 2.421875 | 2 |
tests/storage/util/test_paths.py | cdknorow/modelstore | 0 | 12769560 | <gh_stars>0
# Copyright 2020 <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
#
# Unless required by applicable law ... | 2.015625 | 2 |
src/astro/files/types/ndjson.py | astro-projects/astro | 71 | 12769561 | import io
import json
from typing import Optional
import pandas as pd
from astro.constants import DEFAULT_CHUNK_SIZE
from astro.constants import FileType as FileTypeConstants
from astro.files.types.base import FileType
class NDJSONFileType(FileType):
"""Concrete implementation to handle NDJSON file type"""
... | 2.84375 | 3 |
Task2C.py | Talha1337/ia-flood-risk-project-94- | 0 | 12769562 | <reponame>Talha1337/ia-flood-risk-project-94-<gh_stars>0
from floodsystem.stationdata import build_station_list, update_water_levels
from floodsystem.flood import stations_highest_rel_level
stations = build_station_list()
update_water_levels(stations)
print(stations_highest_rel_level(stations,10)) #list of 10 stations ... | 2.28125 | 2 |
test/mgen.py | I-Rinka/build-cpu-within-20days | 5 | 12769563 | <reponame>I-Rinka/build-cpu-within-20days
import random
test_reg = ("$0", "$1", "$2", "$16", "$26", "$27")
def get_reg():
return test_reg[random.randint(0, len(test_reg)-1)]
imm_inst = ("lui", "ori", "andi", "addi", "addiu")
def get_imm_inst():
ins = imm_inst[random.randint(0, len(imm_inst)-1)]
rs = ... | 2.1875 | 2 |
utils/det_filter.py | rishyak/liverseg-2017-nipsws | 107 | 12769564 | <gh_stars>100-1000
import numpy as np
from scipy import misc
import os
import scipy.io
from PIL import Image
def filter(base_root, crops_list='crops_LiTS_gt.txt', input_config='masked_out_lesion', results_list='detection_lesion_example', th=0.5):
crops_list = base_root + 'utils/crops_list/' + crops_list
resu... | 2.265625 | 2 |
instaboost/exceptions.py | twangnh/Calibration_mrcnn | 87 | 12769565 | class TrimapError(Exception):
"""
Error when creating matting trimap.
"""
def __init__(self, err):
super(TrimapError, self).__init__(err)
class AnnError(Exception):
"""
Error with Input annotation.
"""
def __init__(self, err):
super(AnnError, self).__init__(err)
| 2.640625 | 3 |
Joy_QA_Platform/ApiManager/operations/operation_task.py | bzc128/Joy_QA_Platform | 123 | 12769566 | import datetime
import json
import re
import os
import requests
import time
import threading
import pickle
from django.core.mail import send_mail
from django.db import connection
from django.http import JsonResponse
from django.shortcuts import render_to_response, render
from django.core.cache import cache
from ApiMa... | 1.953125 | 2 |
test_integration/test_R3_protocol.py | rgaensler/gcode | 0 | 12769567 | <filename>test_integration/test_R3_protocol.py<gh_stars>0
import pytest
from src.ApplicationExceptions import ErrorDispatch
from src.Coordinate import Coordinate
from src.MelfaCoordinateService import MelfaCoordinateService
from src.clients.TcpClientR3 import TcpClientR3
from src.clients.TcpEchoServer import Configura... | 2.109375 | 2 |
submitter/__main__.py | deconst/submitter | 1 | 12769568 | <gh_stars>1-10
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import logging
import sys
from datetime import datetime
from .config import Config
from .submit import submit, SUCCESS, NOOP
c = Config(os.environ)
# Configure the logger.
# <= INFO to stdout
# >= WARNING to stderr
class LessThanFilter(logging.... | 2.5 | 2 |
germanetpy/wictionaryparaphrase.py | Blubberli/GermaNetPy | 2 | 12769569 | <reponame>Blubberli/GermaNetPy<filename>germanetpy/wictionaryparaphrase.py
class WiktionaryParaphrase:
def __init__(self, lexunit_id: str, wiktionary_id: str, wiktionary_sense_id: int, wiktionary_sense: str,
edited: bool):
"""
This class holds the Wictionary paraphrase object. A wi... | 2.890625 | 3 |
modules/base.py | VinhLoiIT/stock-trend-predictions | 3 | 12769570 | <reponame>VinhLoiIT/stock-trend-predictions<gh_stars>1-10
class StockTrendPredictor:
def predict(self, headline: str) -> int:
r"""Predict stock trending from the given headline
Args:
headline: the news headline
Returns:
A prediction, 0 for not-changed or downward t... | 2.390625 | 2 |
scripts/rviz_spacenav.py | kalashgera/rviz_spacenav | 0 | 12769571 | <filename>scripts/rviz_spacenav.py<gh_stars>0
#!/usr/bin/env python
import numpy
import tf
import rospy
from geometry_msgs.msg import Twist
from view_controller_msgs.msg import CameraPlacement
class RvizSpacenav:
def __init__(self):
# parameters
self.hz = 20 # hz fot CameraPlacement Topic
... | 2.171875 | 2 |
main.py | 850078897/Project-game- | 0 | 12769572 | <filename>main.py
import pygame
import pygame_textinput
import test_game
from pygame.locals import *
from pygame.compat import unichr_, unicode_
import sys
import locale
from room import Room
pygame.init()
display_width = 800
display_height = 533
clock = pygame.time.Clock()
crashed= False
intro_page= pygame.ima... | 3.015625 | 3 |
utils.py | codePerfectPlus/ComputerVision-Essentials | 15 | 12769573 | <gh_stars>10-100
from google_drive_downloader import GoogleDriveDownloader as gdd
download_dict = {
"16gAKScYAW0bZkyRgcLF71x28du_mLY8-": "assets/res10_300x300_ssd_iter_140000.caffemodel",
"1jUIwxXjxz8oC7I2Ta9vtiozsB4i95043": "Media/people-walking.mp4",
"1Q7qfr11olEFguRRkKRnC1Yah3ZnJCUnM": "assets/mask_rcnn... | 2.578125 | 3 |
tests/helpers_for_tests.py | CrazyVideoGamez/auto-backup | 0 | 12769574 | <reponame>CrazyVideoGamez/auto-backup
"""Helpers for my tests"""
from subprocess import Popen, PIPE
from collections import namedtuple
# Runargs function
Output = namedtuple('Output', 'out, err')
def run_args_on_parser(cmd: list):
"""Run arguments to parser (doesn't create side effects).
Note: the output.out will ... | 2.734375 | 3 |
mpos/app_upgrade.py | cackharot/ngen-milk-pos | 0 | 12769575 | <filename>mpos/app_upgrade.py
import sys
import os
import re
from datetime import datetime
from glob import glob
import zipfile
from subprocess import call
EXTRACT_PATH = "/home/pi"
USB_DRV_PATH = "/home/pi/usbdrv"
FIRMWARE_PATH = "/home/pi/usbdrv/mpos_firmware"
# USB_DRV_PATH = "/media/usb0"
USB_DRV_MOUNT_PATH = "/d... | 2.1875 | 2 |
plottrace.py | gvrooyen/SocialLearning | 1 | 12769576 | <reponame>gvrooyen/SocialLearning
# Copyright (c) 2012 Stellenbosch University, 2012
# This source code is released under the Academic Free License 3.0
# See https://github.com/gvrooyen/SocialLearning/blob/master/LICENSE for the full text of the license.
# Author: <NAME> <<EMAIL>>
"""
Script to estimate the rate at wh... | 2.65625 | 3 |
python_modules/dagster/dagster/core/types/config_schema.py | vishvananda/dagster | 0 | 12769577 | from dagster import check
from dagster.utils import single_item
from .builtin_enum import BuiltinEnum
from .config import ConfigType, List, Nullable
from .wrapping import WrappingListType, WrappingNullableType
class InputSchema:
@property
def schema_type(self):
check.not_implemented(
'Mus... | 2.09375 | 2 |
examples/Skype_model/agent_skypeClient.py | Juliet-Chunli/cnss | 14 | 12769578 | <reponame>Juliet-Chunli/cnss<gh_stars>10-100
'''Implementation of a Skype-like Peer-2-Peer network agent
@author: <NAME> <<EMAIL>>
'''
from ComplexNetworkSim import NetworkAgent, Sim
#states:
DISABLED = 0
ENABLED = 1
ENABLED_S = 2
DISABLED_S = 3
DEAD = 4
#type:
NODE = 0
SUPERNODE = 1
class Skyp... | 2.90625 | 3 |
blog/urls.py | boost-entropy-repos-org/ojas | 0 | 12769579 | from django.conf.urls import url
from django.urls import path,include
from . import views
from .feeds import LatestPostsFeed
from .views import search, PostViewSet
from rest_framework import routers
from django.views.generic import TemplateView
router = routers.DefaultRouter()
router.register(r'api', PostViewSet)
... | 1.992188 | 2 |
src/electionguard/utils.py | ajweiss/electionguard-python | 1 | 12769580 | <reponame>ajweiss/electionguard-python<gh_stars>1-10
from datetime import datetime
from typing import Callable, Optional, TypeVar
T = TypeVar("T")
U = TypeVar("U")
def get_optional(optional: Optional[T]) -> T:
"""
General-purpose unwrapping function to handle `Optional`.
Raises an exception if it's actua... | 2.953125 | 3 |
tests/test_dependencies/test_overrides.py | adriangb/xpresso | 75 | 12769581 | <filename>tests/test_dependencies/test_overrides.py
from dataclasses import dataclass
from di.dependant import Marker
from xpresso import App, Depends, Path
from xpresso.dependencies import Injectable
from xpresso.testclient import TestClient
from xpresso.typing import Annotated
def test_override_with_marker() -> N... | 2.171875 | 2 |
eclipse-mosquitto/test/broker/09-plugin-auth-acl-pub.py | HenriqueBuzin/mosquitto-eclipse-mqtt | 2 | 12769582 | <gh_stars>1-10
#!/usr/bin/env python3
# Bug specific test - if a QoS2 publish is denied, then we publish again with
# the same mid to a topic that is allowed, does it work properly?
from mosq_test_helper import *
def write_config(filename, port, plugin_ver):
with open(filename, 'w') as f:
f.write("port %... | 2.1875 | 2 |
mopidy_sevensegmentdisplay/actor.py | JuMalIO/mopidy-sevensegmentdisplay | 0 | 12769583 | <reponame>JuMalIO/mopidy-sevensegmentdisplay
from __future__ import unicode_literals
import pykka
import logging
from mopidy.core import CoreListener
from worker import Worker
logger = logging.getLogger('Frontend')
class Frontend(pykka.ThreadingActor, CoreListener):
worker = Worker()
def __init__(self, con... | 2.03125 | 2 |
src/secondaires/navigation/equipage/postes/__init__.py | stormi/tsunami | 0 | 12769584 | <filename>src/secondaires/navigation/equipage/postes/__init__.py
# -*-coding:Utf-8 -*
# Copyright (c) 2012 <NAME>
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source c... | 1.210938 | 1 |
manage.py | Mmlh1/effbot | 3 | 12769585 | import subprocess
import os, signal, time
def run_as_test():
proc = subprocess.Popen('python ./bot.py')
time.sleep(10)
if getattr(signal, 'SIGKILL', None):
os.kill(proc.pid, signal.SIGKILL)
else:
os.kill(proc.pid, signal.SIGTERM)
return True
# def run_as_live():
# proc = subpro... | 2.421875 | 2 |
presidio-analyzer/presidio_analyzer/batch_analyzer_engine.py | presid-io/presidio | 0 | 12769586 | import logging
from typing import List, Iterable, Dict, Union, Any, Optional, Iterator, Tuple
from presidio_analyzer import DictAnalyzerResult, RecognizerResult, AnalyzerEngine
from presidio_analyzer.nlp_engine import NlpArtifacts
logger = logging.getLogger("presidio-analyzer")
class BatchAnalyzerEngine:
"""
... | 2.609375 | 3 |
2020/day3/day3-toboggan_trajectory.py | calvinatian/Advent-of-Code | 0 | 12769587 | # Part 1: 187
# Part 2: 4723283400
class Slope():
def __init__(self, path):
"""
input path to text file
text file should contain map data consisting of "." for open spaces, "#" for trees
"""
# put file data into 2D array of characters "." and "#"
with open(path, "r"... | 3.984375 | 4 |
faceai/opencv/trackbar.py | xurohanmm/faceai | 9,944 | 12769588 | #coding=utf-8
#调色板
import cv2
import numpy as np
img = np.zeros((300, 512, 3), np.uint8)
cv2.namedWindow('image')
def callback(x):
pass
#参数1:名称;参数2:作用窗口,参数3、4:最小值和最大值;参数5:值更改回调方法
cv2.createTrackbar('R', 'image', 0, 255, callback)
cv2.createTrackbar('G', 'image', 0, 255, callback)
cv2.createTrackbar('B', 'image... | 3.234375 | 3 |
baseOptimizer.py | DanielMckenzie/HadRGD | 0 | 12769589 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Base class. Eventually all optimizers will be implemented as classes with this
as the base class.
"""
class BaseOptimizer(object):
'''
Placeholder for now. Will eventually convert all methods to
instances of this class.
'''
pass | 2.40625 | 2 |
Flooder/SyncFlood.py | FalseG0d/BasicHacking | 0 | 12769590 | <gh_stars>0
#!/usr/bin/python
from scapy.all import *
def syncFlood(src,tgt,message):
for dport in range(1024,65535):
IPLayer=IP(src=src,dst=tgt)
TCPlayer=TCP(sport=4444,dport=dport)
RawLayer=Raw(load=message)
pkt=IPLayer/TCPlayer/RawLayer
send(pkt)
source="8.8.8.8" #raw_input("[*] Enetr Source IP to fake... | 2.828125 | 3 |
threatconnect-sdk-addons/app-package-plugin/src/test/resources/package/python/__main__.py | ThreatConnect-Inc/threatconnect-java | 4 | 12769591 | import os
import sys
# import inspect
def main():
lib_directory = None
# All Python Version that will be searched
lib_major_version = 'lib_{}'.format(sys.version_info.major)
lib_minor_version = '{}.{}'.format(lib_major_version, sys.version_info.minor)
lib_micro_version = '{}.{}'.format(lib_minor_v... | 2.71875 | 3 |
app/main.py | huangstan1215/IRCPokerDatabase | 1 | 12769592 | import os
from irc_poker_data_set import IrcPokerData as ipd
basedir = os.path.abspath(os.path.dirname(__file__))
irc_poker_data = ipd()
irc_poker_data.open()
from irc_poker_db import db_session, PlayerRanking
def player_ranking():
if db_session.query(PlayerRanking).count() >= db_session.query(ipd.Player).cou... | 2.6875 | 3 |
modules/manip_info_formater.py | ANSSI-FR/Faults_analyzer | 6 | 12769593 | import os, sys
from importlib import import_module
sys.path += [os.getcwd()]
def get_params(params_file, import_path=""):
"""Extract the params object from a given Python file.
:param str params_file: the Python file to get the params object from.
:returns: the params object from the given Python file.... | 3.4375 | 3 |
buildbuild/properties/tests/test_available_language.py | buildbuild/buildbuild | 5 | 12769594 | from properties.models import AvailableLanguage
from django.test import TestCase
from django.core.exceptions import ObjectDoesNotExist
class TestLanguage(TestCase):
fixtures = ['properties_data.yaml']
def setUp(self):
self.non_exist_lang = "never_exist_lang"
self.lang_python = "Python"
... | 2.328125 | 2 |
pyorb/diagram/orbitallevels.py | sunxb05/aichem | 1 | 12769595 | # -*- coding: utf-8 -*-
from .energydiagram import ED
import matplotlib.pyplot as plt
import re
ADJUSTEDCOEFFICIENT=0.02
def GetFrontIndex(orbSign):
# In: HOMO/LUMO/HOMO-1/LUMO+1
# Out: {'hoLu': 'HOMO', 'num': -1}
for matchString in [r'HOMO(.*)', r'LUMO(.*)']:
matchObj = re.match(matchString, orbSign)
... | 2.6875 | 3 |
questioneer/questions/__init__.py | markdentoom/Questioneer | 0 | 12769596 | # https://docs.djangoproject.com/en/4.0/ref/applications/#for-application-authors
# Shouldn't be needed for Django >= 3.2
default_app_config = "questions.apps.QuestionsConfig"
| 1.164063 | 1 |
project/settings.py | AnttiKoistinen431a/parking-permits | 0 | 12769597 | from os import getenv
from pathlib import Path
import dj_database_url
BASE_DIR = Path(__file__).resolve().parent.parent
SECRET_KEY = getenv("DJANGO_SECRET_KEY")
DEBUG = getenv("DEBUG") == "true"
ALLOWED_HOSTS = ["*"]
AUTH_USER_MODEL = "users_app.CustomUser"
INSTALLED_APPS = [
"django.contrib.admin",
"d... | 1.835938 | 2 |
ci/deployment-tests/runtime_config_deploymenttest.py | RedisLabs/tile-generator | 0 | 12769598 | <reponame>RedisLabs/tile-generator
# tile-generator
#
# Copyright (c) 2015-Present Pivotal Software, Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://ww... | 2.03125 | 2 |
flink-python/pyflink/table/tests/test_environment_settings.py | imaffe/flink | 1 | 12769599 | ################################################################################
# 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... | 1.703125 | 2 |
crypto/Residues/chal.py | Enigmatrix/hats-ctf-2019 | 5 | 12769600 | from secret import flag
from random import randint
from Crypto.Util.number import isPrime, GCD
def next_prime(s):
if s%6 == 0:
s += 1
elif s%6 != 1:
s = s - s%6 + 5
while True:
if isPrime(s) == True:
break
s+=2
if isPrime(s) == True:
break
... | 3.5 | 4 |
pygeocom.py | siyka-au/pygeocom | 4 | 12769601 | from typing import Tuple, Any
from enum import Enum, IntFlag
from datetime import datetime
from collections import namedtuple
from collections.abc import Callable
GRC_TPS = 0x0000 # main return codes (identical to RC_SUP!!)
GRC_SUP = 0x0000 # supervisor task (identical to RCBETA!!)
GRC_ANG = 0x0100 # angle- and ... | 2.09375 | 2 |
nixtract/cli/cifti.py | htwangtw/nixtract | 4 | 12769602 | <gh_stars>1-10
"""Functions for command line interface
"""
import argparse
import os
import shutil
from nilearn.signal import clean
from nixtract.cli.base import (base_cli, handle_base_args, replace_file_ext,
make_param_file, check_glob, run_extraction)
from nixtract.extractors import Ci... | 2.3125 | 2 |
RLcafe/frozen_lake.py | SimonPreissner/machine-learning-potpourri | 3 | 12769603 | '''Code from python notebook by simoninithomas
available at https://github.com/simoninithomas/Deep_reinforcement_learning_Course/blob/master/Q%20learning/Q%20Learning%20with%20FrozenLake.ipynb
'''
import numpy as np
import gym
import random
env = gym.make("FrozenLake-v0")
action_size = env.action_space.n
state_siz... | 3.015625 | 3 |
old/scripts/play.py | raehik/dotfiles | 3 | 12769604 | #!/usr/bin/env python3
#
# Play a game.
#
import raehutils
import sys, os, argparse, logging
class PlayPy(raehutils.RaehBaseClass):
ERR_MATCH = 1
def __init__(self):
retroarch_cores_dir = os.environ.get("HOME") + "/.config/retroarch/cores"
games_dir = os.environ.get("HOME") + "/media/games-lo... | 2.078125 | 2 |
django_query_capture/utils.py | LeeHanYeong/django-query-capture | 62 | 12769605 | <reponame>LeeHanYeong/django-query-capture
import io
import sys
from contextlib import ContextDecorator
from django.utils import termcolors
from django_query_capture.capture import CapturedQuery
from django_query_capture.settings import get_config
class CaptureStdOutToString(ContextDecorator):
def __enter__(sel... | 2.4375 | 2 |
tree/bst/find mode in binary search tree.py | windowssocket/py_leetcode | 3 | 12769606 | <reponame>windowssocket/py_leetcode<gh_stars>1-10
class Solution(object):
def findMode(self, root):
"""
:type root: TreeNode
:rtype: List[int]
"""
global_val = list()
global_num = 0
if root is None:
return global_val
def in_traverse(root... | 2.9375 | 3 |
diagrams/oci/edge.py | Shimpei-GANGAN/diagrams | 1 | 12769607 | # This module is automatically generated by autogen.sh. DO NOT EDIT.
from . import _OCI
class _Edge(_OCI):
_type = "edge"
_icon_dir = "resources/oci/edge"
class CdnGrey(_Edge):
_icon = "cdn-grey.png"
class Cdn(_Edge):
_icon = "cdn.png"
class DnsGrey(_Edge):
_icon = "dns-grey.png"
class Dn... | 1.546875 | 2 |
didi/deep/SasRecV3/model.py | bhneo/SparsePooling | 0 | 12769608 | import tensorflow as tf
from tensorflow.keras.regularizers import l2
from tensorflow.keras.layers import Layer, Dense, LayerNormalization, Dropout, Embedding, Input, PReLU
from modules import *
from tensorflow import keras
from tensorflow.keras.models import Model
# api functional model
def get_sasrec(maxlen, item_fea... | 2.4375 | 2 |
tests/python/generated_typing_t.py | mychiux413/ConstConv | 0 | 12769609 | from .generated_typing import MultiLangs, ZH_TW, EN
def test_generated():
ml = MultiLangs(ZH_TW)
assert ml.hello == "您好,歡迎"
assert ml.login == "登入"
assert ml.select_lang == "繁體中文"
ml.set_lang(EN)
assert ml.hello == "Hello,Welcome"
assert ml.login == "Login"
assert ml.select_lang == "E... | 2.265625 | 2 |
tests/hikari/utilities/test_event_stream.py | tomxey/hikari | 0 | 12769610 | # -*- coding: utf-8 -*-
# Copyright (c) 2020 Nekokatt
#
# 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, me... | 1.695313 | 2 |
UTest/dataset_test.py | rzumer/VideoLowLevelVision | 3 | 12769611 | <gh_stars>1-10
import os
if not os.getcwd().endswith('UTest'):
os.chdir('UTest')
from VLLV.DataLoader.Dataset import _glob_absolute_pattern, load_datasets
DATASETS = load_datasets('./data/fake_datasets.yml')
def test_glob_absolute_pattern():
URL = './data/set5_x2'
node = _glob_absolute_pattern(URL)
... | 2.28125 | 2 |
setup.py | vsevolod-kolchinsky/py-ugs3client | 1 | 12769612 | <gh_stars>1-10
from setuptools import setup
def readme():
with open('README.md') as f:
return f.read()
setup(name='py-ugs3client',
version='0.9.1',
description='UGS3 Python client',
long_description=readme(),
classifiers=[
'Development Status :: 4 - Beta',
... | 1.484375 | 1 |
dnazip/burros_wheeler.py | dabane-ghassan/dnazip | 5 | 12769613 | # -*- coding: utf-8 -*-
"""
Burrows-Wheeler Algorithm Class, contains naive and advanced construction
methods, static methods were written as explicit as possible and were
factorized to facilitate algorithmic readability.
The yielding in some functions doesn't respect Space complexity, but it was done in this
manner to... | 3.609375 | 4 |
meerschaum/Pipe/_fetch.py | bmeares/Meerschaum | 32 | 12769614 | <gh_stars>10-100
#! /usr/bin/env python
# -*- coding: utf-8 -*-
# vim:fenc=utf-8
"""
Functions for fetching new data into the Pipe
"""
from __future__ import annotations
from meerschaum.utils.typing import Optional, Any
def fetch(
self,
begin : Optional[datetime.datetime] = None,
end : Option... | 2.375 | 2 |
sdk/python/pulumi_azure_native/servicefabricmesh/v20180701preview/_inputs.py | sebtelko/pulumi-azure-native | 0 | 12769615 | # coding=utf-8
# *** WARNING: this file was generated by the Pulumi SDK Generator. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
import warnings
import pulumi
import pulumi.runtime
from typing import Any, Mapping, Optional, Sequence, Union, overload
from ... import _utilities
fro... | 1.453125 | 1 |
cisco-ios-xr/ydk/models/cisco_ios_xr/Cisco_IOS_XR_tunnel_nve_oper.py | tkamata-test/ydk-py | 0 | 12769616 | """ Cisco_IOS_XR_tunnel_nve_oper
This module contains a collection of YANG definitions
for Cisco IOS\-XR tunnel\-nve package operational data.
This module contains definitions
for the following management objects\:
nve\: NVE operational data
Copyright (c) 2013\-2016 by Cisco Systems, Inc.
All rights reserved.
""... | 1.867188 | 2 |
src/scs_philips_hue/cmd/cmd_mqtt_subscriber.py | south-coast-science/scs_philips_hue | 0 | 12769617 | <reponame>south-coast-science/scs_philips_hue<filename>src/scs_philips_hue/cmd/cmd_mqtt_subscriber.py
"""
Created on 23 Mar 2017
@author: <NAME> (<EMAIL>)
"""
import optparse
# --------------------------------------------------------------------------------------------------------------------
class CmdMQTTSubscrib... | 2.15625 | 2 |
plagiarism-checker.py | scv1702/plagiarism-checker | 0 | 12769618 | import os.path
import numpy as np
from nltk.corpus import stopwords
from nltk.tokenize import word_tokenize
from numpy import dot
from numpy.linalg import norm
class NotIntegerError(Exception):
pass
# 문서를 불러와 단어로 토큰화 후, 단어들을 word_list에 저장후 word_list 반환
def doc_tokenize(doc_name):
with open(doc_name, 'rt') as... | 2.828125 | 3 |
cloudendure/cloudendure_api/models/cloud_endure_user.py | cloudreach/cloudendure-python | 11 | 12769619 | # coding: utf-8
"""
CloudEndure API documentation
© 2017 CloudEndure All rights reserved # General Request authentication in CloudEndure's API is done using session cookies. A session cookie is returned upon successful execution of the \"login\" method. This value must then be provided within the request hea... | 2.40625 | 2 |
alipay/aop/api/domain/QuotaGradientRule.py | antopen/alipay-sdk-python-all | 213 | 12769620 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
from alipay.aop.api.constant.ParamConstants import *
class QuotaGradientRule(object):
def __init__(self):
self._score_400 = None
self._score_450 = None
self._score_500 = None
self._score_550 = None
self._score_600 ... | 2.0625 | 2 |
landmark_generate/generate.py | yourmean/Moving-Emoji-Generation_Sol1 | 4 | 12769621 | <reponame>yourmean/Moving-Emoji-Generation_Sol1<filename>landmark_generate/generate.py<gh_stars>1-10
import os
import torch
import matplotlib.pyplot as plt
import numpy as np
generator = torch.load('generator_100000.pytorch', map_location={'cuda:0':'cpu'})
generator.eval()
# v, _ = generator.sample_videos(1, 16)
# v.s... | 2.5 | 2 |
lilu/context.py | xyla-io/lilu | 0 | 12769622 | from enum import Enum
from typing import Optional, List, Dict
class TimeGranularity(Enum):
hourly = 'hourly'
daily = 'daily'
@property
def api_value(self) -> str:
if self is TimeGranularity.hourly:
return 'STAT_TIME_GRANULARITY_HOURLY'
elif self is TimeGranularity.daily:
return 'STAT_TIME_... | 2.765625 | 3 |
examples/raspicam.py | tanyafish/unicorn-hat-hd | 0 | 12769623 | <filename>examples/raspicam.py
#!/usr/bin/env python
# This is a modified version of <NAME>'s Astro Cam example,
# from: https://github.com/bennuttall/sense-hat-examples/blob/master/python/astro_cam.py
try:
from picamera import PiCamera
from picamera.array import PiRGBArray
except ImportError:
exit('This ... | 2.921875 | 3 |
Plots/Contours/NCL_conwomap_2.py | learn2free/GeoCAT-examples | 1 | 12769624 | """
NCL_conwomap_2.py
=================
This script illustrates the following concepts:
- Drawing a simple filled contour plot
- Selecting a different color map
- Changing the size/shape of a contour plot
See following URLs to see the reproduced NCL plot & script:
- Original NCL script: https://www.ncl.uc... | 3.28125 | 3 |
rename2.py | a67878813/script | 0 | 12769625 | # -*- coding: gbk -*-
path1 = u'K:\\选择删除\\' #所需修改文件夹所在路径
import os
import zhconv
for parent, dirnames, filenames in os.walk(path1):
for filename in filenames:
try:
os.rename(os.path.join(parent, filename), os.path.join(parent, zhconv.convert(filename, 'zh-cn')))
#print(zhconv.convert... | 3.3125 | 3 |
sampyl/samplers/base.py | madanh/sampyl | 0 | 12769626 | from itertools import count
import time
from ..core import np, auto_grad_logp, AUTOGRAD
from ..parallel import parallel
from ..progressbar import update_progress
from ..state import State, func_var_names
from ..model import init_model
class Sampler(object):
def __init__(self, logp, start,
grad_lo... | 2.015625 | 2 |
wrappers/samtools/stats/wrapper.py | delvinso/crg2 | 7 | 12769627 | <reponame>delvinso/crg2
"""Snakemake wrapper for trimming paired-end reads using cutadapt."""
__author__ = "<NAME>"
__copyright__ = "Copyright 2017, <NAME>"
__email__ = "<EMAIL>"
__license__ = "MIT"
from snakemake.shell import shell
extra = snakemake.params.get("extra", "")
region = snakemake.params.get("region", ... | 1.828125 | 2 |
pyleaves/train/example_train.py | JacobARose/pyleaves | 3 | 12769628 | <filename>pyleaves/train/example_train.py<gh_stars>1-10
"""
Created on Mon Feb 10 03:23:32 2019
script: pyleaves/pyleaves/train/example_train.py
@author: JacobARose
"""
def main(experiment_config, experiment_dir):
############################################
#TODO: Moving towards defining most or all run ... | 2.046875 | 2 |
boilerio/schedulerweb_zones.py | adpeace/boilerio | 4 | 12769629 | import datetime
from flask_restx import Namespace, Resource, fields, marshal
from flask import request
from . import model
from .schedulerweb_util import get_db
api = Namespace('Zones', title="Zone management")
a_zone = api.model('Zone', {
'zone_id': fields.Integer(description="ID of zone"),
'name': fields... | 2.5625 | 3 |
src/WinePrediction.py | Raghuvp01/winePrediction | 0 | 12769630 | <filename>src/WinePrediction.py<gh_stars>0
import sys
import pyspark
from pyspark.ml import Pipeline
from pyspark.ml.classification import RandomForestClassifier
from pyspark.ml.evaluation import MulticlassClassificationEvaluator
from pyspark.ml.feature import IndexToString, StringIndexer, VectorIndexer
from py... | 2.921875 | 3 |
cli/filter.py | sanaakhelloqi/pcapstats | 0 | 12769631 | <reponame>sanaakhelloqi/pcapstats
import src.utils as utils
from src.Sieve import Sieve
from pathlib import Path
import click
import json
from concurrent.futures import ProcessPoolExecutor
import tqdm
def filter_target_wrapper(data):
return filter_target(*data)
def filter_target(target, original_pcap, json_fil... | 2.5 | 2 |
paragraph_batch_utils.py | pavelmk/dynamic_rnn | 0 | 12769632 | <filename>paragraph_batch_utils.py<gh_stars>0
import numpy as np
def batch_data_generator(data, batch_size, n_epochs=-1):
""" Takes data, then yields it in batches for n_epochs epochs. Wraps around the end
of the dataset to repeat until the specified number of epochs is reached. We make
the choice ... | 3.109375 | 3 |
medium/python/c0104_216_combination-sum-iii/00_leetcode_0104.py | drunkwater/leetcode | 0 | 12769633 | <gh_stars>0
# DRUNKWATER TEMPLATE(add description and prototypes)
# Question Title and Description on leetcode.com
# Function Declaration and Function Prototypes on leetcode.com
#216. Combination Sum III
#Find all possible combinations of k numbers that add up to a number n, given that only numbers from 1 to 9 can be u... | 3.5 | 4 |
downsample_images.py | fireofearth/giraffe | 0 | 12769634 | import os
import logging
import glob
import pathlib
import argparse
import multiprocessing as mp
import cv2
#import matplotlib.pyplot as plt
logging.basicConfig(
format="%(asctime)s: %(levelname)s: %(message)s", level=logging.INFO
)
def parse_arguments():
argparser = argparse.ArgumentParser(description=__doc... | 2.703125 | 3 |
migrations/versions/f4a2a808cf0a_.py | ingalls/ml-enabler | 39 | 12769635 | <reponame>ingalls/ml-enabler<gh_stars>10-100
"""empty message
Revision ID: f4a2a808cf0a
Revises: c2<PASSWORD>
Create Date: 2019-05-20 17:46:02.329310
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = 'f4a2a808cf0a'
down_revision = 'c<PASSWORD>'
branch_labels = No... | 1.351563 | 1 |
shuffler/lib/subcommands/dbEvaluate.py | pscedu/mlstamps_oltr | 0 | 12769636 | import os, os.path as op
import logging
import numpy as np
import cv2
import progressbar
import ast
import matplotlib.pyplot as plt
import matplotlib.ticker as ticker
import pprint
import PIL
from lib.backend import backendDb
from lib.backend import backendMedia
from lib.utils import util
def add_parsers(subparsers)... | 2.25 | 2 |
scripts/merra-concat-dailyrad.py | jenfly/atmos-read | 3 | 12769637 | <gh_stars>1-10
import sys
sys.path.append('/home/jwalker/dynamics/python/atmos-tools')
sys.path.append('/home/jwalker/dynamics/python/atmos-read')
sys.path.append('/home/jwalker/dynamics/python/monsoon-onset')
import xarray as xray
import numpy as np
import collections
import pandas as pd
import scipy
import atmos as... | 2.203125 | 2 |
SerieAByJBot.py | leeprinxin/TaiwanWebCrawler | 0 | 12769638 | <gh_stars>0
import requests, bs4
import json
from datetime import datetime
from datetime import datetime, timezone, timedelta
import traceback, pymssql
import time
from selenium import webdriver
import selenium
from selenium.webdriver.chrome.options import Options
from time import sleep # this should go at th... | 2.6875 | 3 |
misc/deep_learning_notes/Ch3 Advanced Tensorflow/GPU and device management tests/2_single_device_indepth.py | tmjnow/MoocX | 7 | 12769639 | import tensorflow as tf
"""
Instruction to the code there can be found at:
https://www.tensorflow.org/versions/r0.10/how_tos/using_gpu/index.html
"""
# Creates a graph.
with tf.device('/cpu:0'):
a = tf.constant([1.0, 2.0, 3.0, 4.0, 5.0, 6.0], shape=[2, 3], name='a')
b = tf.constant([1.0, 2.0, 3.0, 4.0, 5.0, 6.... | 3.4375 | 3 |
InvenTree/InvenTree/test_api.py | onurtatli/InvenTree | 0 | 12769640 | """ Low level tests for the InvenTree API """
from rest_framework import status
from django.urls import reverse
from InvenTree.api_tester import InvenTreeAPITestCase
from users.models import RuleSet
from base64 import b64encode
class APITests(InvenTreeAPITestCase):
""" Tests for the InvenTree API """
fi... | 2.734375 | 3 |
mom/__init__.py | ands904/ands904-tinypyclone | 16 | 12769641 | <reponame>ands904/ands904-tinypyclone<filename>mom/__init__.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright 2011 <NAME> <<EMAIL>>
# Copyright 2012 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the... | 1.8125 | 2 |
picasso/inpainters/interfaces.py | giuspugl/picasso | 2 | 12769642 | #
#
#
#
# date: 2019-08-20
# author: <NAME>
# python3.6
# Copyright (C) 2019 <NAME> <EMAIL>
#
#import .deep_prior_inpainter as dp
#import .contextual_attention_gan as ca
#import .nearest_neighbours_inpainter as nn
from inpainters import (
deep_prior_inpainter as dp ,
contextual_attention_gan as ... | 2.359375 | 2 |
examples/hica/injectors/env_passthrough.py | connectthefuture/docker-hacks | 0 | 12769643 | # vim: set fileencoding=utf-8
# <NAME> <<EMAIL>>
#
# HICA - Host integrated container applications
#
# MIT License (C) 2015
import os
from base.hica_base import *
class EnvPassthroughInjector(HicaInjector):
def get_description(self):
return "Bind mounts current environment into the container"
def get_config_... | 1.867188 | 2 |
lib/python3.8/site-packages/ansible_collections/netapp/ontap/plugins/modules/na_ontap_quota_policy.py | cjsteel/python3-venv-ansible-2.10.5 | 0 | 12769644 | <reponame>cjsteel/python3-venv-ansible-2.10.5<filename>lib/python3.8/site-packages/ansible_collections/netapp/ontap/plugins/modules/na_ontap_quota_policy.py
#!/usr/bin/python
# (c) 2019, NetApp, Inc
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
'''
na_ontap_quota_policy
... | 1.6875 | 2 |
snacks/tests.py | Samerodeh/DjangoX- | 0 | 12769645 | from django.test import TestCase
from django.contrib.auth import get_user_model
from django.urls import reverse
from .models import Snack
# Create your tests here.
class SnacksTests(TestCase):
def setUp(self):
self.user = get_user_model().objects.create_user(
username = 'samer', email = '<EMA... | 2.515625 | 3 |
tests/factories.py | sarafanio/sarafan | 2 | 12769646 | import factory
from sarafan.events import Publication
from .utils import generate_rnd_hash, generate_rnd_address
class PublicationFactory(factory.Factory):
class Meta:
model = Publication
reply_to = '0x'
magnet = factory.LazyFunction(lambda: generate_rnd_hash()[2:])
source = factory.LazyFunc... | 1.96875 | 2 |
src/cdc/songs_cdc.py | tomfran/lastfm-project | 1 | 12769647 | <reponame>tomfran/lastfm-project
from .abstract_classes import AbstractRegistryCDC
from datetime import datetime
import json
class SongsCDC(AbstractRegistryCDC):
"""
Songs cdc implementation
It implements a registry cdc logic, as songs can change over
time, and no chrono attribute can be used.
... | 2.96875 | 3 |
xclim/testing/tests/test_cli.py | Ouranosinc/dcvar | 1 | 12769648 | #!/usr/bin/env python
# Tests for `xclim` package, command line interface
from __future__ import annotations
import numpy as np
import pytest
import xarray as xr
from click.testing import CliRunner
import xclim
from xclim.cli import cli
from xclim.testing import open_dataset
try:
from dask.distributed import Cli... | 2.09375 | 2 |
frangiclave/csjson.py | frangiclave/frangiclave-compendium | 16 | 12769649 | from typing import Any, List, Dict, Union, Tuple, TextIO
# Left here for now; should I delete it?
def load(fh: TextIO) -> Union[Dict[str, Any], List[Any]]:
return loads(fh.read())
def loads(json: str) -> Union[Dict[str, Any], List[Any]]:
length = len(json)
num = 0
num = _move_to_next_node(json, num... | 2.90625 | 3 |
cascad/agents/aritifcial_system/chain.py | Will-Holden/cascadv2 | 0 | 12769650 | <filename>cascad/agents/aritifcial_system/chain.py
"""Simulate the chain where all smartcontract stored
"""
import uuid
# from utils.myfuncs import Singleton
from cascad.utils.myfuncs import Singleton
from cascad.models.kb import Entity, Property
from cascad.utils.constant import *
from cascad.utils import get_id
has_... | 2.375 | 2 |