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_day12.py | dmies/adventOfCode | 0 | 26400 | from day12 import Moon, simulate_moons, get_steps_to_find_same_state, get_total_energy
def test_init_handles_string_input():
line = "<x=15, y=-2, z=-6>"
expected_x = 15
expected_y = -2
expected_z = -6
result = Moon(line)
assert result.x == expected_x
assert result.y == expected_y
ass... | 3.078125 | 3 |
SudaAutoLogin.py | a386881/- | 1 | 26401 | <gh_stars>1-10
# -*- coding:utf-8 -*-
VERSION = r'2016/04/02'
# 配置中心
URL = "http://wg.suda.edu.cn/indexn.aspx"
STUDENT_ID = 'XXXXXXXXXXXXXXXXXXXX'
STUDENT_PASSWORD = '<PASSWORD>'
'''
Created on 2016年4月2日
@author: XenoAmess
'''
import urllib.parse
import urllib.request
import time
def get_html(url):
... | 3.125 | 3 |
app/healthcheck/monitor.py | publichealthengland/coronavirus-dashboard-easy-read | 1 | 26402 | <reponame>publichealthengland/coronavirus-dashboard-easy-read<filename>app/healthcheck/monitor.py
#!/usr/bin python3
"""
<Description of the programme>
Author: <NAME> <<EMAIL>>
Created: 15 Mar 2021
License: MIT
Contributors: <NAME>
"""
# Imports
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~... | 1.53125 | 2 |
src/dev/gym-tensegrity/gym_tensegrity/envs/jumper_test.py | hany606/Tensegrity_Robotics | 0 | 26403 | import gym
import gym_tensegrity
import numpy as np
import os
from time import sleep
# Discrete action space functions testing
def main(port_num=10042):
def print_observation(obs):
print("Observations {:}".format(obs))
env = gym.make('gym_tensegrity:jumper-v0')
# action = randint(0,15)
action =... | 3.296875 | 3 |
lane_identifier.py | samguns/Project4-Advanced-Lane-Finding | 0 | 26404 | import numpy as np
import matplotlib.pyplot as plt
import cv2
class LaneIdentifier:
def __init__(self, smooth_factor, filter):
self.left_lane_inds = []
self.right_lane_inds = []
self.lane_gap = []
self.binary_warped = None
self.window_height = None
self.leftx_current... | 2.890625 | 3 |
test_tree.py | lightmanca/InterviewPrep | 0 | 26405 | import pytest
from Tree import Tree
class TestClass:
def setup_class(self):
pass
def test_tree(self):
tree = Tree()
tree.add(3)
tree.add(4)
tree.add(0)
tree.add(8)
tree.add(2)
tree.print_tree()
assert True
def test_compare_trees(se... | 3.390625 | 3 |
03_Day_Operators/10.py | diegofregolente/30-Days-Of-Python | 0 | 26406 | <gh_stars>0
x1 = 1
y1 = 0
x2 = 0
y2 = -2
m1 = (y2 / x1)
x1 = 2
y1 = 2
x2 = 6
y2 = 10
m2 = (y2 - y1 / x2 - x1)
diff = m1 - m2
print(f'Diff of 8 and 9: {diff:.2f}') # 10 | 3.015625 | 3 |
zsh/gitstatus.py | liuyang1/dotfiles | 1 | 26407 | <filename>zsh/gitstatus.py
#! /usr/ibn/env python2
# -*- encoding=utf-8 -*-
from __future__ import print_function
from subprocess import Popen, PIPE
import os
import serverlog
log = serverlog.inst()
def getGitStat(d):
gitstat = Popen(
['git', 'status', '--short', '--branch'],
stdout=PIPE, stderr... | 2.515625 | 3 |
exercises/networking_selfpaced/networking-workshop/collections/ansible_collections/community/general/plugins/module_utils/utm_utils.py | tr3ck3r/linklight | 0 | 26408 | # This code is part of Ansible, but is an independent component.
# This particular file snippet, and this file snippet only, is BSD licensed.
# Modules you write using this snippet, which is embedded dynamically by Ansible
# still belong to the author of the module, and may assign their own license
# to the complete wo... | 1.367188 | 1 |
application/migrations/0002_auto_20200901_2057.py | KMaina/counselling-app | 0 | 26409 | # Generated by Django 3.1 on 2020-09-01 17:57
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('application', '0001_initial'),
]
operations = [
migrations.AlterField(
model_name='client',
name='link',
f... | 1.625 | 2 |
disks/bootstrap/root/lib.py | pnhowe/disks | 0 | 26410 | import sys
import time
import subprocess
import re
_setMessage = None
class Bootstrap:
def __init__( self, identifier, contractor ):
self.identifier = identifier
self.request = contractor.request
self.request( 'call', '/api/v1/Survey/Cartographer(register)', { 'identifier': identifier } )
def look... | 2.34375 | 2 |
src/backup_utils/databases/__init__.py | Oprax/backup-utils | 0 | 26411 | <gh_stars>0
from functools import partial
from ..utils import load
__all__ = ["databases"]
databases = partial(load, pkg="backup_utils.databases", suffix="Db")
| 1.554688 | 2 |
code_examples/tensorflow/basic_nmt_example/seq2seq_edits/attention_wrapper.py | Splendon/examples | 0 | 26412 | <filename>code_examples/tensorflow/basic_nmt_example/seq2seq_edits/attention_wrapper.py
# Copyright 2019 Graphcore Ltd.
'''
Edits to seq2seq AttentionWrapper
'''
import tensorflow as tf
class AttentionWrapperNoAssert(tf.contrib.seq2seq.AttentionWrapper):
# Stops the adding of Assert operations that "assert_equal"... | 2.046875 | 2 |
deeppavlov/agents/coreference/models.py | deepmipt/kpi2017 | 3 | 26413 | # Copyright 2017 Neural Networks and Deep Learning lab, MIPT
#
# 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 applicab... | 1.976563 | 2 |
applications/plugins/RigidScale/examples/mapping/rigidScaleToRigidMultiMapping.py | sofa-framework/issofa | 0 | 26414 | <reponame>sofa-framework/issofa
import sys,os
import Sofa
import Flexible.IO
from Compliant import Tools as Tools
# main path
currentdir = os.path.dirname(os.path.realpath(__file__))+'/'
__file = __file__.replace('\\', '/') # windows compatible filename
source = './mesh/cube.obj'
target = './mesh/cube.obj'
... | 2.09375 | 2 |
peptidereactor/iFeature/codes/TA.py | spaenigs/peptidereactor | 3 | 26415 | #!/usr/bin/env python
#_*_coding:utf-8_*_
import sys, os, re
pPath = os.path.split(os.path.realpath(__file__))[0]
sys.path.append(pPath)
import checkFasta
def TA(fastas, **kw):
if checkFasta.checkFasta(fastas) == False:
print('Error: for "TA" encoding, the input fasta sequences should be with equal length. \n\n')
... | 2.859375 | 3 |
services/mx/service.py | sbworth/getnoc | 84 | 26416 | <gh_stars>10-100
#!./bin/python
# ----------------------------------------------------------------------
# mx service
# ----------------------------------------------------------------------
# Copyright (C) 2007-2021 The NOC Project
# See LICENSE for details
# -----------------------------------------------------------... | 1.875 | 2 |
rectifier/config/config_parser.py | SectorLabs/heroku-rectifier | 7 | 26417 | <reponame>SectorLabs/heroku-rectifier
import json
from json import JSONDecodeError
from typing import Dict
import jsonschema
import structlog
import schemas
from rectifier.config import Config, AppConfig, QueueConfig, CoordinatorConfig, AppMode
from rectifier.storage.storage import Storage
from rectifier import setti... | 2.4375 | 2 |
market.py | hype-ecosystem/predictions_bot | 2 | 26418 | <filename>market.py
import subprocess as sp
import datetime
import sys
import re
import os
import pwd
import logging
import logging.handlers
import bitfinex_api
from dbmanager import DatabaseManager
from plot_provider import PlotProvider
import queue
class Market:
def __init__(self, path, symbol, message_queue):... | 2.296875 | 2 |
launch/gl_ros2_driver_udp.py | soslab-project/gl_ros2_driver_udp | 3 | 26419 | <reponame>soslab-project/gl_ros2_driver_udp
import os
import launch
from launch_ros.actions import Node
from ament_index_python.packages import get_package_share_directory
def generate_launch_description():
gl_ros2_driver_udp = Node(
node_name = 'gl_ros2_driver_udp',
package = 'gl_ros2_driver_udp... | 2.265625 | 2 |
Analysis Scripts/sum_individual.py | bonesbb/HASPR | 1 | 26420 | <reponame>bonesbb/HASPR
# HASPR - High-Altitude Solar Power Research
# Script to calculate annual sums given generation profiles
# Version 0.1
# Author: neyring
import haspr
from haspr import Result
from numpy import genfromtxt
from os import walk
import numpy as np
# PARAMETERS #
# path to directory cont... | 2.734375 | 3 |
COPS.py | abphilip-codes/Codechef_Practice | 2 | 26421 | # https://www.codechef.com/problems/COPS
for T in range(int(input())):
M,x,y=map(int,input().split())
m,a = list(map(int,input().split())),list(range(1,101))
for i in m:
for j in range(i-x*y,i+1+x*y):
if(j in a): a.remove(j)
print(len(a)) | 2.625 | 3 |
Python Fundamentals/Regular Expressions/More Exercise/Task02_03.py | IvanTodorovBG/SoftUni | 1 | 26422 | <filename>Python Fundamentals/Regular Expressions/More Exercise/Task02_03.py<gh_stars>1-10
import re
data = input()
pattern = r"%([A-Z][a-z]+)%([^|$%.]+)?<(\w+)>([^|$%.]+)?\|(\d+)\|([^|$%.0-9]+)?([0-9]+(\.[0-9]+)?)\$"
total_income = 0
while data != "end of shift":
for match in re.finditer(pattern, data):
... | 3.9375 | 4 |
sky/migrations/0008_remove_news_label.py | eethan1/IMnight2018_Backend | 0 | 26423 | # Generated by Django 2.0 on 2018-02-24 11:21
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('sky', '0007_auto_20180224_1120'),
]
operations = [
migrations.RemoveField(
model_name='news',
name='label',
),
]
| 1.421875 | 1 |
mealpy/utils/visualize/linechart.py | thieu1995/mealpy | 162 | 26424 | #!/usr/bin/env python
# ------------------------------------------------------------------------------------------------------%
# Created by "Thieu" at 17:12, 09/07/2021 %
# ... | 2.125 | 2 |
graphs/functions/scores.py | CSI-BennettUniversity/Sample-Project-1 | 5 | 26425 | import json
from interactions.models import (
SelfAnswerGroup,
)
def update_dict_with_score(valid_dict: list) -> list:
""" Updates the dict (from single and multiple_result_view) with
the scores of each user present in the list, by calculating their
``answer_choice`` and multiplying them with corresp... | 2.453125 | 2 |
authenticationApp/EmailHandler.py | George-Okumu/IReporter-Django | 0 | 26426 | <reponame>George-Okumu/IReporter-Django
from django.core.mail import EmailMessage, message
class EmailHandlerClass:
@staticmethod
def sendEmail(data):
email = EmailMessage(subject=data['email_subject'], body=data['email_body'], to=[data['email_to']])
email.send()
# email.send()
... | 2.140625 | 2 |
checkdns.py | delcacho/DataSciencePlatform | 0 | 26427 | <gh_stars>0
from area53 import route53
from boto.route53.exception import DNSServerError
from kubernetes import client, config
from datetime import datetime
import socket
import time
# Ensure cluster is running
consec = 0
while consec < 10:
try:
ip = socket.gethostbyname("http://api.k8s.dev.bayescluster.com")
... | 2.21875 | 2 |
config/urls.py | ISI-MIP/isimip | 0 | 26428 | <filename>config/urls.py
from __future__ import unicode_literals
from django.conf import settings
from django.conf.urls import include, url
from django.conf.urls.static import static
from django.contrib import admin
from django.views import defaults as default_views
from wagtail.admin import urls as wagtailadmin_urls
... | 1.726563 | 2 |
eyesore/decision_graph/graph.py | twizmwazin/hacrs | 2 | 26429 | <filename>eyesore/decision_graph/graph.py
from collections import defaultdict, namedtuple
import re
class DiGraph(object):
"""Implementation of directed graph"""
# Stand for a cell in a dot node rendering
DotCellDescription = namedtuple("DotCellDescription",
["text", ... | 2.859375 | 3 |
variation/multiplex.py | FCG-LLC/snmpsim | 0 | 26430 | #
# This file is part of snmpsim software.
#
# Copyright (c) 2010-2017, <NAME> <<EMAIL>>
# License: http://snmpsim.sf.net/license.html
#
# Managed value variation module: simulate a live Agent using
# a series of snapshots.
#
import os, time, bisect
from pyasn1.compat.octets import str2octs
from pysnmp.proto import rfc... | 1.875 | 2 |
migrations/versions/ac4799fb0cd3_.py | anngle/t923 | 1 | 26431 | """empty message
Revision ID: <KEY>
Revises: 3b042c12d85e
Create Date: 2018-12-12 22:47:40.070151
"""
from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects import mysql
# revision identifiers, used by Alembic.
revision = '<KEY>'
down_revision = '<KEY>'
branch_labels = None
depends_on = None
def u... | 1.71875 | 2 |
cisco-ios-xr/ydk/models/cisco_ios_xr/_meta/_Cisco_IOS_XR_fretta_bcm_dpa_drop_stats_oper.py | tkamata-test/ydk-py | 0 | 26432 | <filename>cisco-ios-xr/ydk/models/cisco_ios_xr/_meta/_Cisco_IOS_XR_fretta_bcm_dpa_drop_stats_oper.py
import re
import collections
from enum import Enum
from ydk._core._dm_meta_info import _MetaInfoClassMember, _MetaInfoClass, _MetaInfoEnum
from ydk.types import Empty, YList, YLeafList, DELETE, Decimal64, FixedBits... | 1.476563 | 1 |
main.py | Dinxor/tstore | 0 | 26433 | from tkinter import Tk, Button, Label
from threading import Thread
from queue import Queue
import configparser
import sys
import os
def init_config(path):
config.optionxform = str
config.read(path)
def maingui():
for name in tt['modules'].keys():
tt[name]['label'].config(text=str(tt[name].get('c... | 2.5 | 2 |
titan/logger.py | KhaosResearch/TITAN-API | 0 | 26434 | import logging.config
def configure_logging():
DEFAULT_LOGGING_CONFIG = {
"version": 1,
"disable_existing_loggers": False,
"formatters": {
"basic": {
"format": "[%(asctime)s] [%(name)s] [%(levelname)s] %(message)s",
"datefmt": "%Y-%m-%d %H:%M:%S"... | 2.4375 | 2 |
Raia2011/model/name2idx/species.py | okadalabipr/cancer_signaling | 1 | 26435 | NAMES = [
'IL13stimulation',
'Rec',
'Rec_i',
'IL13_Rec',
'p_IL13_Rec',
'p_IL13_Rec_i',
'JAK2',
'pJAK2',
'SHP1',
'STAT5',
'pSTAT5',
'SOCS3mRNA',
'DecoyR',
'IL13_DecoyR',
'SOCS3',
'CD274mRNA',
]
for idx, name in enumerate(NAMES):
exec(
'{} = {:d... | 2.203125 | 2 |
OpenGLWrapper_JE/venv/Lib/site-packages/OpenGL/GL/ARB/map_buffer_range.py | JE-Chen/je_old_repo | 0 | 26436 | '''OpenGL extension ARB.map_buffer_range
This module customises the behaviour of the
OpenGL.raw.GL.ARB.map_buffer_range to provide a more
Python-friendly API
Overview (from the spec)
ARB_map_buffer_range expands the buffer object API to allow greater
performance when a client application only needs to ... | 2.015625 | 2 |
src/python/src/grpc/framework/foundation/_later_test.py | iMilind/grpc | 1 | 26437 | <reponame>iMilind/grpc
# Copyright 2015, Google Inc.
# 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 code must retain the above copyright
# notice, this list ... | 1.601563 | 2 |
tests/test_stage.py | bytedance/raylink | 17 | 26438 | <gh_stars>10-100
from unittest import TestCase
from raylink.data.stage import GPUStage
import numpy as np
import torch
import time
class TestStage(TestCase):
@classmethod
def setUpClass(cls) -> None:
cls.shape = [20, 1024, 1024]
cls.num = 50
cls.zero = np.zeros(cls.shape)
cls.a... | 2.234375 | 2 |
forgetPass.py | goyal705/Hotel-Management-System | 1 | 26439 | <reponame>goyal705/Hotel-Management-System
from tkinter import *
from tkinter import ttk
from tkinter import messagebox
import mysql.connector
from login_new import Small_login_win
class Forget_pass_win:
def __init__(self, root):
self.root = root
self.root.title("Forget Password")
... | 3.3125 | 3 |
mmdet/models/rroi_extractors/arbox_multi_levels.py | ZZR8066/AerialDetection | 6 | 26440 | from __future__ import division
import torch
import torch.nn as nn
from mmdet import ops
from ..registry import ROI_EXTRACTORS
import pdb
@ROI_EXTRACTORS.register_module
class ARboxMultiRoIExtractor(nn.Module):
"""Extract RoI features from a single level feature map.
If there are mulitple input feature leve... | 2.21875 | 2 |
docs/podstawy/przyklady/ocenyfun.py | damiankarol7/python101 | 44 | 26441 | <filename>docs/podstawy/przyklady/ocenyfun.py
#! /usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Moduł ocenyfun zawiera funkcje wykorzystywane w pliku 05_oceny_03.py
"""
import math # zaimportuj moduł matematyczny
def drukuj(co, kom="Sekwencja zawiera: "):
print(kom)
for i in co:
print(i, end=... | 3.71875 | 4 |
kubernetes_typed/client/models/v2beta2_metric_status.py | sobolevn/kubernetes-typed | 22 | 26442 | # Code generated by `typeddictgen`. DO NOT EDIT.
"""V2beta2MetricStatusDict generated type."""
from typing import TypedDict
from kubernetes_typed.client import V2beta2ExternalMetricStatusDict, V2beta2ObjectMetricStatusDict, V2beta2PodsMetricStatusDict, V2beta2ResourceMetricStatusDict
V2beta2MetricStatusDict = TypedDi... | 1.453125 | 1 |
tests/test_env_runner.py | pistarlab/simpleland | 4 | 26443 | <reponame>pistarlab/simpleland
import pytest
from landia.env import LandiaEnv, LandiaEnvSingle
import time
from landia.clock import clock
def test_env():
agent_map = {str(i):{} for i in range(4)}
env = LandiaEnv(agent_map=agent_map,dry_run=False)
start_time = time.time()
max_steps = 2000
dones = ... | 2.0625 | 2 |
helpers/simulation_helpers/scripts/simulated_robot_driver.py | GT-RAIL/assistance_arbitration | 0 | 26444 | #!/usr/bin/env python
# Simulate the /robot_driver so that interfaces to it can operate the same on
# the real robot and in simulation
from __future__ import print_function, division
from threading import Lock
import rospy
import diagnostic_updater
from diagnostic_msgs.msg import DiagnosticStatus
from fetch_driver_... | 2.875 | 3 |
docs/source/conf.py | suzil/awsstepfuncs | 3 | 26445 | # Configuration file for the Sphinx documentation builder.
#
# This file only contains a selection of the most common options. For a full
# list see the documentation:
# https://www.sphinx-doc.org/en/master/usage/configuration.html
# -- Path setup --------------------------------------------------------------
# If ex... | 1.445313 | 1 |
day-07.py | analuisadev/100-Days-Of-Code | 2 | 26446 | from random import randint
from time import sleep
print ('=' * 18)
print ('\033[1mSTONE PAPER AND SCISSORS\033[m')
print ('=' * 18)
print ('I already chose mine now missing you')
sleep (1)
computer = randint (1, 3)
player = int(input('\033[1mChoose between\033[m \033[1;33m1) Stone 2) Paper and 3) Scissors\033[m : '))... | 3.796875 | 4 |
tmdb/three/reviews.py | Cologler/ezapi-tmdb | 4 | 26447 | from .base import ENDPOINT, process_response
class ReviewsMixin:
@process_response
def get_review_details(self, review_id, **kwargs):
"""
GET /review/{review_id}
"""
url = f"{ENDPOINT}/3/review/{review_id}"
return self.make_request("GET", url, kwargs)
| 2.078125 | 2 |
app/models/domain/position.py | Chaoyingz/paper_trading | 0 | 26448 | <reponame>Chaoyingz/paper_trading
from datetime import datetime
from pydantic import Field
from app.models.base import DBModelMixin
from app.models.domain.stocks import Stock
from app.models.types import PyDecimal, PyObjectId
class Position(Stock):
"""持仓股票"""
volume: int = Field(..., description="持仓量")
... | 2.71875 | 3 |
drink_partners/middlewares/tests/test_exception_handler.py | henriquebraga/drink-partners | 0 | 26449 | <filename>drink_partners/middlewares/tests/test_exception_handler.py
import json
import pytest
from aiohttp.web import HTTPGatewayTimeout
from drink_partners.contrib.exceptions import APIException
from drink_partners.contrib.response import JSONResponse
from drink_partners.middlewares.exception_handler import (
e... | 2.265625 | 2 |
tase/telegram/inline_buttons/choose_language_button.py | soran-ghaderi/Chromusic_search_engine | 4 | 26450 | <filename>tase/telegram/inline_buttons/choose_language_button.py
import pyrogram
from .inline_button import InlineButton
from ..telegram_client import TelegramClient
# from ..handlers import BaseHandler
from ...db import DatabaseClient, graph_models
from ...utils import _trans
class ChooseLanguageInlineButton(Inline... | 2.390625 | 2 |
blog/forms.py | Ukyply/Ukyply-SQLite | 0 | 26451 | <reponame>Ukyply/Ukyply-SQLite
from django import forms
from blog.models import Post
class PostForm(forms.ModelForm):
class Meta:
model= Post
fields = ('title','text')
labels = {
'title':'Söz Başy',
'text':'Hat',
}
def save_form(self, request, instance,... | 2.59375 | 3 |
rules/tamper/wordpress.py | lavon321/Kunlun-M | 1,059 | 26452 | # -*- coding: utf-8 -*-
"""
wordpress
~~~~
tamper for wordpress
:author: LoRexxar <<EMAIL>>
:homepage: https://github.com/LoRexxar/Kunlun-M
:license: MIT, see LICENSE for more details.
:copyright: Copyright (c) 2017 LoRexxar. All rights reserved
"""
wordpress = {
"esc_url": [10... | 1.296875 | 1 |
tests/test_utils.py | szarnyasg/pygraphblas | 0 | 26453 | <gh_stars>0
from pygraphblas import *
def test_add_identity():
A = Matrix.sparse(INT8, 10, 10)
assert add_identity(A) == 10
A = Matrix.sparse(INT8, 10, 10)
A[5,5] = 42
assert add_identity(A) == 9
| 2.453125 | 2 |
bentoml/paddle.py | francoisserra/BentoML | 1 | 26454 | from ._internal.frameworks.paddle import load
from ._internal.frameworks.paddle import save
from ._internal.frameworks.paddle import load_runner
from ._internal.frameworks.paddle import import_from_paddlehub
__all__ = ["import_from_paddlehub", "load", "load_runner", "save"]
| 1.109375 | 1 |
src/leetcode_1673_find_the_most_competitive_subsequence.py | yurirocha15/coding_practice | 2 | 26455 | # @l2g 1673 python3
# [1673] Find the Most Competitive Subsequence
# Difficulty: Medium
# https://leetcode.com/problems/find-the-most-competitive-subsequence
#
# Given an integer array nums and a positive integer k,
# return the most competitive subsequence of nums of size k.
# An array's subsequence is a resulting seq... | 3.90625 | 4 |
data/compress.py | Catosine/GDAS | 20 | 26456 | <reponame>Catosine/GDAS<filename>data/compress.py
# python ./data/compress.py $TORCH_HOME/ILSVRC2012/ $TORCH_HOME/ILSVRC2012-TAR tar
# python ./data/compress.py $TORCH_HOME/ILSVRC2012/ $TORCH_HOME/ILSVRC2012-ZIP zip
import os, sys
from pathlib import Path
def command(prefix, cmd):
print ('{:}{:}'.format(prefix, cmd... | 2.40625 | 2 |
tests/test_fastly_logging_s3.py | Jimdo/ansible-role-fastly | 12 | 26457 | #!/usr/bin/env python
import os
import unittest
import sys
from test_common import TestCommon
sys.path.append(os.path.join(os.path.dirname(__file__), '..', 'library'))
from fastly_service import FastlyConfiguration
class TestFastlyLoggingS3(TestCommon):
@TestCommon.vcr.use_cassette()
def test_fastly_s3s(sel... | 2.046875 | 2 |
高频120_Lint/Reverse Nodes in k-Group.py | lixiaoruiusa/Rui7272 | 0 | 26458 | <filename>高频120_Lint/Reverse Nodes in k-Group.py
"""
Definition of ListNode
class ListNode(object):
def __init__(self, val, next=None):
self.val = val
self.next = next
"""
class Solution:
"""
@param head: a ListNode
@param k: An integer
@return: a ListNode
@ O(n) time | O(1) sp... | 3.984375 | 4 |
C21/test.py | jpch89/learningpython | 2 | 26459 | <gh_stars>1-10
'求平方根'
from math import sqrt
li = [2, 4, 9, 16, 25]
# for 循环版本
res = []
for i in li:
res.append(sqrt(i))
print(res)
# map 版本
print(list(map(sqrt, li)))
# 列表推导式版本
print([sqrt(i) for i in li])
# 生成器版本
print(list(sqrt(i) for i in li))
| 3.03125 | 3 |
tests/links_tests/model_tests/yolo_tests/test_yolo_v3.py | souravsingh/chainercv | 1,600 | 26460 | <reponame>souravsingh/chainercv<filename>tests/links_tests/model_tests/yolo_tests/test_yolo_v3.py
import numpy as np
import unittest
import chainer
from chainer import testing
from chainer.testing import attr
from chainercv.links import YOLOv3
@testing.parameterize(*testing.product({
'n_fg_class': [1, 5, 20],
}... | 2.296875 | 2 |
src/training/train.py | KinanZ/open_clip | 0 | 26461 | <reponame>KinanZ/open_clip
import os
import time
import json
import numpy as np
import torch
import torch.nn as nn
from sklearn import decomposition
from torch.cuda.amp import autocast
import torch.distributed as dist
import sys
sys.path.append('/misc/student/alzouabk/Thesis/self_supervised_pretraining/open_clip_the... | 2.25 | 2 |
jade_utils.py | gimenete/jade-utils-sublime | 0 | 26462 | <filename>jade_utils.py
from HTMLParser import HTMLParser
import sublime, sublime_plugin
void_elements = ["area", "base", "br", "col", "embed", "hr",
"img", "input", "keygen", "link", "menuitem",
"meta", "param", "source", "track", "wbr"]
class JadeUtilsHtml(sublime_plugin.TextCommand):
def run(self, edi... | 2.71875 | 3 |
modules/MessageWatcher/MessageWatcher.py | ediril/BCI | 6 | 26463 | <gh_stars>1-10
import numpy as np
import Dragonfly_config as rc
from argparse import ArgumentParser
from ConfigParser import SafeConfigParser
from PyDragonfly import Dragonfly_Module, CMessage, copy_to_msg, copy_from_msg
from time import time
class MessageWatcher(object):
# msg_types = ['GROBOT_RAW_FEEDBACK',
... | 2.25 | 2 |
Plug-and-play module/attention/CBAM/cbam.py | riciche/SimpleCVReproduction | 923 | 26464 | <filename>Plug-and-play module/attention/CBAM/cbam.py
import torch
import torch.nn as nn
def conv3x3(in_planes, out_planes, stride=1):
"3x3 convolution with padding"
return nn.Conv2d(in_planes,
out_planes,
kernel_size=3,
stride=stride,
... | 2.515625 | 3 |
nyc/dataprep/PrepareTreeData.py | lopez86/NYCDataTools | 0 | 26465 | #! /usr/bin/env python3
""" PrepareTreeData.py
Prepares the tree data a bit for inclusion into a database.
"""
import pandas as pd
import numpy as np
""" Prepare the tree data for inclusion into a database.
Args:
inname: Input file
outname: Output file
"""
def PrepareTreeData(inname='data/street_trees_2015... | 3.359375 | 3 |
pyqha/alphagruneisen.py | mauropalumbo75/pyqha | 10 | 26466 | #encoding: UTF-8
# Copyright (C) 2016 <NAME>
# This file is distributed under the terms of the # MIT License.
# See the file `License' in the root directory of the present distribution.
"""
An earlier and now oblosete implementation of functions for computing the
thermal expansion tensor as a function
of temperatur... | 2.046875 | 2 |
allennlp/tests/fixtures/plugins/project_c/allennlp_plugins/c/__init__.py | justindujardin/allennlp | 1 | 26467 | <gh_stars>1-10
from c.c import C
| 0.878906 | 1 |
cro/fitness.py | VictorPelaez/coral-reef-optimization-algorithm | 21 | 26468 | from __future__ import division
import numpy as np
from sklearn.utils import shuffle
from sklearn.metrics import *
"""
Module with different fitness functions implemented to be used by the CRO algorithm.
The functions' only argument must be an individual (coral) and return its fitness, a number.
The fitness might re... | 3.203125 | 3 |
lib/environment/shape.py | vyahello/snakegame-gui | 0 | 26469 | from abc import ABC, abstractmethod
from typing import Tuple, Iterable, Any
from pygame.rect import Rect
class Shape(ABC):
"""Abstract shape interface."""
@abstractmethod
def shape(self) -> Any:
pass
@abstractmethod
def top_left(self) -> Tuple:
pass
@abstractmethod
def t... | 3.703125 | 4 |
bleak/backends/device.py | virantha/bleak | 0 | 26470 | # -*- coding: utf-8 -*-
"""
Wrapper class for Bluetooth LE servers returned from calling
:py:meth:`bleak.discover`.
Created on 2018-04-23 by hbldh <<EMAIL>>
"""
class BLEDevice(object):
"""A simple wrapper class representing a BLE server detected during
a `discover` call.
- When using Windows backend, ... | 2.359375 | 2 |
jqueryui/jqueryui.py | yyuunn0044/oss-hubblemon | 0 | 26471 | <gh_stars>0
#
# Hubblemon - Yet another general purpose system monitor
#
# Copyright 2015 NAVER Corp.
#
# 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/LICEN... | 1.859375 | 2 |
diffrax/solver/kvaerno5.py | FedericoV/diffrax | 377 | 26472 | import numpy as np
from ..local_interpolation import ThirdOrderHermitePolynomialInterpolation
from .runge_kutta import AbstractESDIRK, ButcherTableau
γ = 0.26
a21 = γ
a31 = 0.13
a32 = 0.84033320996790809
a41 = 0.22371961478320505
a42 = 0.47675532319799699
a43 = -0.06470895363112615
a51 = 0.16648564323248321
a52 = 0.... | 1.585938 | 2 |
Hinting/Remove Zero Deltas in Selected Glyphs.py | justanotherfoundry/Glyphs-Scripts | 283 | 26473 | #MenuTitle: Remove Zero Deltas in Selected Glyphs
# -*- coding: utf-8 -*-
from __future__ import division, print_function, unicode_literals
__doc__="""
Goes through all layers of each selected glyph, and deletes all TT Delta Hints with an offset of zero. Detailed Report in Macro Window.
"""
def process( Layer ):
try:... | 2.359375 | 2 |
env/build.py | orestisfl/docker-env | 0 | 26474 | #!/usr/bin/env python3
import re
import sys
from glob import glob
from subprocess import run
def main(args):
assert len(args) >= 1
from_image = args.pop(0)
optional = [x for x in map(str.strip, args) if x]
optional_used = set()
with open("Dockerfile", "w") as fout:
print(f"from {from_ima... | 2.578125 | 3 |
tiled/database/core.py | stuartcampbell/tiled | 0 | 26475 | <gh_stars>0
import hashlib
import uuid as uuid_module
from datetime import datetime
from alembic import command
from alembic.config import Config
from alembic.runtime import migration
from sqlalchemy.orm import sessionmaker
from sqlalchemy.sql import func
from .alembic_utils import temp_alembic_ini
from .base import ... | 2.140625 | 2 |
torchvision/prototype/utils/__init__.py | yoshitomo-matsubara/vision | 12,063 | 26476 | <reponame>yoshitomo-matsubara/vision<filename>torchvision/prototype/utils/__init__.py
from . import _internal
| 0.972656 | 1 |
py/models.py | ti-ginkgo/Severstal | 2 | 26477 | import torch
import torch.nn as nn
import torch.nn.functional as F
import torchvision
class FPAv2(nn.Module):
def __init__(self, input_dim, output_dim):
super(FPAv2, self).__init__()
self.glob = nn.Sequential(nn.AdaptiveAvgPool2d(1),
nn.Conv2d(input_dim, output_di... | 2.59375 | 3 |
gameNode_test.py | rcolomina/pythonchess | 0 | 26478 | #!/usr/bin/python
from piece import Piece
from gameNode import GameNode
from functions import *
from minmax import MinMax
## TEST 1: GameNode cration. Generating list of movements on a game node by piece
print "TEST 1: Building a Game Node"
listPiecesWhite=[]
listPiecesBlack=[]
p1=Piece('Q',[2,1])
p2=Piece('N'... | 3.390625 | 3 |
discordlogger.py | tjb0607/discord-logger | 3 | 26479 | <gh_stars>1-10
#!/usr/bin/python3
# WARNING: Self-botting is technically against the rules, so this script could potentially get you banned.
import http.client
import json
import urllib
import time
import getpass
import os.path
import datetime
import sys
from dateutil.parser import parse
print("usage: python3 discor... | 2.296875 | 2 |
msschem/runner.py | andreas-h/mss-chem | 0 | 26480 | <filename>msschem/runner.py
# -*- coding: utf-8 -*-
from __future__ import print_function
import argparse
import datetime
import logging
import os.path
import runpy
import sys
VERBOSE = True
QUIET = False
# TODO allow parallel download of different models
# TODO allow parallel download of species (??)
def _valid_... | 2.171875 | 2 |
oscar_mws/fulfillment/__init__.py | ButchershopCreative/django-oscar-mws | 12 | 26481 | from django.utils.translation import ugettext_lazy as _
SHIPPING_STANDARD = 'Standard'
SHIPPING_EXPEDITED = 'Expedited'
SHIPPING_PRIORITY = 'Priority'
SHIPPING_SPEED_CATEGORIES = (
(SHIPPING_STANDARD, _("Standard")),
(SHIPPING_EXPEDITED, _("Expedited")),
(SHIPPING_PRIORITY, _("Priority")),
)
METHOD_CONS... | 1.914063 | 2 |
utils/Deque.py | FedePeralta/ASVs_Deep_Reinforcement_Learning_with_CNNs | 4 | 26482 | <filename>utils/Deque.py
import numpy as np
from utils.Node import Node
class Deque(object):
"""Generic deque object"""
def __init__(self, max_size, dimension_of_value_attribute):
self.max_size = max_size
self.dimension_of_value_attribute = dimension_of_value_attribute
self.deque = sel... | 3.40625 | 3 |
main.py | fedegy/Practica-1-Lenguajes-Formales | 0 | 26483 | import os
from tkinter import *
from tkinter import filedialog
global archivo
archivo= []
cadena2 = []
archivo = []
global cadena_inicial
cadena_inicial = []
global lista_numeros
lista_numeros = []
global intlist
intlist= []
global numeros1
numeros1=[]
global lista_buscar2
lista_buscar2 =... | 3.859375 | 4 |
examples/plot_h2o_ch4.py | ucl-exoplanets/pyexocross | 0 | 26484 | from pyexocross.hitran.hitran import HITRANLinelist
from pyexocross.pyexocross import PyExocross
from pyexocross.exomol.exomolbroads import ExomolBroadener
import numpy as np
from pyexocross.util import create_grid_res, convert_to_wavenumber
from pyexocross.writer.hdf5writer import HDF5Writer
import matplotlib.pyplot a... | 1.914063 | 2 |
bnlp/data/conll2012.py | Nesting-Tech/zc-bnlp | 5 | 26485 | <gh_stars>1-10
# -*- coding: utf-8 -*-
"""
Created by JoeYip on 29/03/2019
:copyright: (c) 2019 by nesting.xyz
:license: BSD, see LICENSE for more details.
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import operator
import re
import sub... | 2.03125 | 2 |
docs/examples/workflow_and_job/hourly_workflow.py | Tismas/bigflow | 0 | 26486 | from bigflow.workflow import Workflow, hourly_start_time
from datetime import datetime
from datetime import timedelta
class HourlyJob:
def __init__(self):
self.id = 'hourly_job'
def run(self, runtime):
print(f'I should process data with timestamps from: {runtime} '
f'to {dateti... | 3.046875 | 3 |
release/stubs.min/System/Windows/Forms/__init___parts/DataGridViewCellStateChangedEventArgs.py | YKato521/ironpython-stubs | 0 | 26487 | class DataGridViewCellStateChangedEventArgs(EventArgs):
"""
Provides data for the System.Windows.Forms.DataGridView.CellStateChanged event.
DataGridViewCellStateChangedEventArgs(dataGridViewCell: DataGridViewCell,stateChanged: DataGridViewElementStates)
"""
@staticmethod
def __new__(self, ... | 1.929688 | 2 |
main.py | philos123/PyBacktesting | 52 | 26488 | #!/usr/local/bin/env python3.7
# -*- coding: utf-8; py-indent-offset:4 -*-
###############################################################################
#
# The MIT License (MIT)
# Copyright (c) 2020 <NAME>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and ass... | 1.484375 | 1 |
ecommerce/cart/migrations/0023_auto_20210314_1656.py | MirjahonMirsaidov/ecommerce-web-app | 0 | 26489 | # Generated by Django 3.1.2 on 2021-03-14 11:56
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('cart', '0022_delete_sendpassword'),
]
operations = [
migrations.AlterField(
model_name='orderbeta',
name='finish_pri... | 1.242188 | 1 |
src/main_video.py | shortvol/sudokusolver | 0 | 26490 | <filename>src/main_video.py
from tensorflow.keras.models import load_model
from src.extract_n_solve.extract_digits import process_extract_digits_single
from src.extract_n_solve.grid_detector_img import main_grid_detector_img
from src.extract_n_solve.grid_solver import main_solve_grid
from src.extract_n_solve.new_img_g... | 2.171875 | 2 |
adscore/__init__.py | shinyichen/ADSCore | 0 | 26491 | <filename>adscore/__init__.py
from adscore import routes
from adscore import api
from adscore import crawlers
from adscore.app import app, create_app
from adscore import tools
from adscore import flask_redis
| 1.429688 | 1 |
examples/twitter_roa/settings.py | lhaze/django-roa | 31 | 26492 | <gh_stars>10-100
import os
ROOT_PATH = os.path.dirname(__file__)
TEMPLATE_DEBUG = DEBUG = True
MANAGERS = ADMINS = ()
DATABASE_ENGINE = 'sqlite3'
DATABASE_NAME = os.path.join(ROOT_PATH, 'testdb.sqlite')
TIME_ZONE = 'America/Chicago'
LANGUAGE_CODE = 'en-us'
SITE_ID = 1
USE_I18N = True
MEDIA_ROOT = ''
MEDIA_URL = ''
AD... | 1.875 | 2 |
allhub/all_hub.py | srinivasreddy/allhub | 2 | 26493 | import os
from urllib.parse import urljoin
import requests
from allhub.activity import ActivityMixin
from allhub.orgs import OrganizationMixin
from allhub.gists import GistMixin
from allhub.oauth import OAuthMixin
from allhub.users import UsersMixin
from allhub.util import MimeType, ConflictCheck, config
from allhub.re... | 1.773438 | 2 |
tests/read_config.py | tyxio/txpy-azurehelper | 0 | 26494 | import logging.config
import os
import yaml
__location__ = os.path.realpath(
os.path.join(os.getcwd(), os.path.dirname(__file__)))
def read_logging_config():
with open(os.path.join(__location__, 'logging.cfg'), 'r') as stream:
try:
logging_config = yaml.safe_load(stream)
logg... | 2.234375 | 2 |
engines/dotflow2/extensions/mscs_sentiment_analysis.py | NunoEdgarGFlowHub/rhizome | 8 | 26495 |
import requests
import logging
from bbot.core import ChatbotEngine, BBotException, BBotCore, BBotExtensionException
from engines.dotflow2.chatbot_engine import DotFlow2LoggerAdapter
class DotFlow2MSCSSentimentAnalysis():
"""ChatScript DotFlow2 function"""
def __init__(self, config: dict, dotbot: dict) -> No... | 2.515625 | 3 |
poor_trader/sample/trading_systems.py | johndpope/poor-trader-py | 1 | 26496 |
import os
import pandas as pd
from poor_trader import config
from poor_trader import trading
from poor_trader import systems
class CombinedIndicators(trading.TradingSystem):
def __init__(self, portfolio, systems_method_list, name='CombinedIndicators'):
super(CombinedIndicators, self).__init__(name=name)
... | 2.625 | 3 |
fileExplorer.py | aff3ct/PyBER | 10 | 26497 | # The MIT License (MIT)
#
# Copyright (c) 2018 PyBER
#
# 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, mer... | 1.445313 | 1 |
code_and_dataset/config_parser.py | pcpLiu/DeepSeqPanII | 11 | 26498 | # -*- coding: utf-8 -*-
import os
import json
import torch
BASE_DIR = os.path.abspath(os.path.dirname(__file__))
class Config:
def __init__(self, json_file):
self.config = json.loads(open(json_file).read())
self.device = torch.device("cuda:1" if torch.cuda.is_available() else "cpu")
self... | 2.1875 | 2 |
tests/test_mean_ess.py | nikopj/NonStationaryFKL | 35 | 26499 | import unittest
import torch
import numpy as np
from spectralgp.samplers import MeanEllipticalSlice
class TestMeanEllipticalSlice(unittest.TestCase):
def test_m_ess(self, nsamples=10000):
pmean = torch.zeros(2)
pmean[0] = -2.
prior_dist = torch.distributions.MultivariateNormal(pmean, covar... | 2.359375 | 2 |