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 |
|---|---|---|---|---|---|---|
src/python/test.py | jdrprod/miniBlock | 0 | 27200 | from cheater import *
from main import *
# new Chain instance with
# mining difficulty = 4
c = Chain(4)
c.createGenesis()
# simulate transactions
c.addBlock(Block("3$ to Arthur"))
c.addBlock(Block("5$ to Bob"))
c.addBlock(Block("12$ to Jean"))
c.addBlock(Block("7$ to Jake"))
c.addBlock(Block("2$ to Camille"))
c.addBl... | 2.78125 | 3 |
Python3/537.py | rakhi2001/ecom7 | 854 | 27201 | <reponame>rakhi2001/ecom7<filename>Python3/537.py
__________________________________________________________________________________________________
sample 24 ms submission
class Solution:
def complexNumberMultiply(self, a: str, b: str) -> str:
A = [int(x) for x in a.replace('i','').split('+')]
B = ... | 3.296875 | 3 |
mindwavemobile/MindwaveMobileRawReader.py | martinezmizael/Escribir-con-la-mente | 0 | 27202 | <filename>mindwavemobile/MindwaveMobileRawReader.py
import bluetooth
import time
import textwrap
class MindwaveMobileRawReader:
START_OF_PACKET_BYTE = 0xaa;
def __init__(self, address=None):
self._buffer = [];
self._bufferPosition = 0;
self._isConnected = False;
self._mindwaveM... | 3.203125 | 3 |
docassemble/InterviewStats/snapshot_statistics.py | BryceStevenWilley/docassemble-InterviewStats | 0 | 27203 | from docassemble.base.util import variables_snapshot_connection, user_info
__all__ = ['get_stats']
def get_stats(filename: str):
conn = variables_snapshot_connection()
cur = conn.cursor()
# use a parameterized query to prevent SQL injection
query = "select modtime, data from jsonstorage where filenam... | 2.703125 | 3 |
radicalsdk/radardsp.py | moodoki/radical_sdk | 7 | 27204 | <reponame>moodoki/radical_sdk
# AUTOGENERATED! DO NOT EDIT! File to edit: nbs/01_radardsp.ipynb (unless otherwise specified).
__all__ = ['cfar_nms', 'range_azimuth_ca_cfar']
# Cell
import numpy as np
from mmwave import dsp
# Cell
def cfar_nms(cfar_in, beamformed_ra, nhood_size=1):
"""non-maxumim suppression fo... | 1.96875 | 2 |
src/primaires/perso/commandes/prompt/__init__.py | stormi/tsunami | 0 | 27205 | # -*-coding:Utf-8 -*
# Copyright (c) 2010 <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 code must retain the above copyright notice, this
# list of cond... | 1.226563 | 1 |
dyndb2csv.py | donwellus/dyndb2csv | 0 | 27206 | <reponame>donwellus/dyndb2csv<gh_stars>0
import click
import json
import csv
import sys
@click.command()
@click.argument('input', type=click.File('rb'))
def cli(input):
"""Dynamodb to CSV
Convert the aws dynamodb output (Scalar types, JSON) to CSV.
\b
Process from stdin:
dyndb2csv -
\b
... | 3.15625 | 3 |
testing/testing-data-gradient.py | jenfly/atmos | 16 | 27207 | import sys
sys.path.append('/home/jwalker/dynamics/python/atmos-tools')
sys.path.append('/home/jwalker/dynamics/python/atmos-read')
import xray
import numpy as np
from datetime import datetime
import matplotlib.pyplot as plt
import pandas as pd
import atmos as atm
import precipdat
import merra
# ---------------------... | 2.203125 | 2 |
adventofcode/solutions/y2021/d06.py | andreasbjornstrom/adventofcode-python | 0 | 27208 | '''
Solution for day 6 of the 2021 Advent of Code calendar.
Run it with the command `python -m adventofcode run_solution -y 2021 6` from the project root.
'''
import time
from adventofcode.types import Solution
class LanternFish:
def __init__(self, timer_til_fork):
self.timer_til_fork = timer_til_fork
... | 3.96875 | 4 |
eval_detector.py | arushi1372/caltech-ee148-spring2021-hw02 | 0 | 27209 | import os
import json
import numpy as np
import matplotlib.pyplot as plt
def compute_iou(box_1, box_2):
'''
This function takes a pair of bounding boxes and returns intersection-over-
union (IoU) of two bounding boxes.
'''
intersection = 0
tlr1, tlc1, brr1, brc1 = box_1[0], box_1[1], box_1[2], ... | 2.953125 | 3 |
enaml/enaml/wx/wx_widget.py | ContinuumIO/ashiba | 11 | 27210 | #------------------------------------------------------------------------------
# Copyright (c) 2013, Nucleic Development Team.
#
# Distributed under the terms of the Modified BSD License.
#
# The full license is in the file COPYING.txt, distributed with this software.
#-------------------------------------------------... | 1.6875 | 2 |
duo_universal_auth/apps.py | tonningp/django-duo-universal-auth | 1 | 27211 | """
Module to register the Django application.
"""
from django.apps import AppConfig
class DuoUniversalAuthConfig(AppConfig):
"""
The specific AppConfig class to register for the Duo Universal
Authentication application.
"""
name = 'duo_universal_auth'
| 1.617188 | 2 |
metaworld/policies/sawyer_push_wall_v2_policy.py | yiwc/robotics-world | 681 | 27212 | <reponame>yiwc/robotics-world<filename>metaworld/policies/sawyer_push_wall_v2_policy.py
import numpy as np
from metaworld.policies.action import Action
from metaworld.policies.policy import Policy, assert_fully_parsed, move
class SawyerPushWallV2Policy(Policy):
@staticmethod
@assert_fully_parsed
def _pa... | 2.296875 | 2 |
solum/common/clients.py | dimtruck/solum | 0 | 27213 | <gh_stars>0
# Copyright 2014 - Rackspace Hosting.
#
# 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 ... | 1.398438 | 1 |
xml_to_text.py | EvanHahn/xml-to-text | 1 | 27214 | #!/usr/bin/env python
from sys import argv
from bs4 import BeautifulSoup
def xml_to_text(file):
return BeautifulSoup(file).get_text()
if __name__ == "__main__":
if len(argv) < 2:
print "What file should I get plain text from?"
exit(1)
print xml_to_text(open(argv[1]))
| 3.59375 | 4 |
lib/exabgp/rib/__init__.py | lochiiconnectivity/exabgp | 0 | 27215 | <filename>lib/exabgp/rib/__init__.py
# encoding: utf-8
"""
rib/__init__.py
Created by <NAME> on 2010-01-15.
Copyright (c) 2009-2015 Exa Networks. All rights reserved.
"""
from exabgp.rib.store import Store
class RIB (object):
# when we perform a configuration reload using SIGUSR, we must not use the RIB
# without... | 2.03125 | 2 |
tests/issues/yubikey.py | wjlei1990/radical.saga | 12 | 27216 |
import radical.saga as saga
c = saga.Context ('ssh')
c.user_id = 'dinesh'
s = saga.Session ()
s.add_context (c)
js = saga.job.Service("lsf+ssh://yellowstone.ucar.edu", session=s)
| 1.609375 | 2 |
projects/rpi_led/project.py | Cruikshanks/electronics | 0 | 27217 | import RPi.GPIO as GPIO
GPIO.setmode(GPIO.BCM)
GPIO.setup(18, GPIO.OUT)
led_state = False
try:
while True:
GPIO.output(18, led_state)
if led_state:
print("The LED is on. Press 'enter' to switch it off")
else:
print("The LED is off. Press 'enter' to switch it on")
... | 3.75 | 4 |
SampleScripts/grasp.py | kyspencer/GAMMA-PC-A-Greedy-Memetic-Algorithm-for-Storing-Cooling-Objects | 0 | 27218 | # grasp.py
# This script implements the GRASP heuristic for the dynamic bin packing
# problem.
# Author: <NAME>
from __future__ import print_function
import numpy as np
import random
import solutions_dynamic as solmaker
import sys
from copy import deepcopy
from itertools import combinations
from math import ceil... | 2.515625 | 3 |
scripts/copy_bundles.py | VIIgit/azul | 0 | 27219 | import argparse
import csv
from datetime import datetime
import logging
import sys
import time
from typing import Set, Tuple
from urllib.parse import urlparse, urlunparse
from botocore.config import Config
from botocore.exceptions import ClientError
from hca.util import SwaggerAPIException
from azul import config, re... | 2.03125 | 2 |
firsttest/models/check.py | charlos1204/firsttest | 0 | 27220 | <gh_stars>0
#import numpy as np
#import pickle
#import sequence2vector as s2v_tools
#y_data_name = '/data/label_dataset.pkl'#
#Y = pickle.load(open(y_data_name, 'rb'))
#print(Y.shape)
#Y = s2v_tools.seq2vectorize(Y)
#print(Y)
from keras.models import Sequential
import plotresults as pltrslts
import pickle
networ... | 2.53125 | 3 |
tools/build.py | kxf3199/gltf_tool | 1 | 27221 | #! /usr/bin/env python3 -B
# build utility for easy development
# complete and unreliable hack used for making it easier to develop
import click, os, platform, markdown, glob, textwrap
def build(target, dirname, buildtype, cmakeopts=''):
os.system('mkdir -p build/{dirname}; cd build/{dirname}; cmake ../../ -GNin... | 2.34375 | 2 |
server/wrangle/config.py | kdinkla/ProtoMPDA | 3 | 27222 | import sqlite3 as lite
import csv
# Constants.
inputPath = "/Users/kdinkla/Desktop/Novartis/HCS/CellMorph/www.ebi.ac.uk/huber-srv/cellmorph/data/"
outputPath = "/Users/kdinkla/MPDA/git/wrangle/db/"
sqlDotReplacement = '_'
# Screening parameters.
plates = ["HT" + str(i).zfill(2) for i in range(1, 69)]
plateDirectories... | 2.671875 | 3 |
src/stationbook/book/tests/test_view_station_borehole_layer_add.py | EIDA/stationbook | 3 | 27223 | from django.urls import resolve, reverse
from .base_classes import NetworkStationTest
from ..views import station_borehole_layer_add
class StationBoreholeLayerAddTests(NetworkStationTest):
def __init__(self, *args):
NetworkStationTest.__init__(
self,
*args,
url="statio... | 2.171875 | 2 |
engfrosh_site/frosh/migrations/0004_alter_team_group.py | engfrosh/engfrosh | 1 | 27224 | # Generated by Django 3.2.3 on 2021-06-19 00:08
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('auth', '0012_alter_user_first_name_max_length'),
('frosh', '0003_alter_team_coin_amount'),
]
operations = [... | 1.515625 | 2 |
CMSIS/DSP/Testing/PatternGeneration/Convolutions.py | milos-lazic/CMSIS_5 | 6 | 27225 | import os.path
import numpy as np
import itertools
import Tools
# Those patterns are used for tests and benchmarks.
# For tests, there is the need to add tests for saturation
def writeTests(config):
NBSAMPLES=128
inputsA=np.random.randn(NBSAMPLES)
inputsB=np.random.randn(NBSAMPLES)
inputsA = inpu... | 2.46875 | 2 |
cesiumpy/entities/tests/test_color.py | cksammons7/cesiumpy | 62 | 27226 | <gh_stars>10-100
#!/usr/bin/env python
# coding: utf-8
import nose
import unittest
import traitlets
import cesiumpy
import cesiumpy.testing as tm
class TestColor(unittest.TestCase):
def test_maybe_color(self):
blue = cesiumpy.color.Color.maybe('blue')
self.assertEqual(repr(blue), "Color.BLUE")... | 2.328125 | 2 |
todo/migrations/0004_alter_post_title.py | Saup21/Todo-list | 14 | 27227 | # Generated by Django 3.2.1 on 2021-05-12 20:04
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('todo', '0003_auto_20210511_0127'),
]
operations = [
migrations.AlterField(
model_name='post',
name='ti... | 1.4375 | 1 |
vn.trader/strategyMain.py | freeitaly/TT | 0 | 27228 | # encoding: UTF-8
import sys
import ctypes
import platform
from vtEngine import MainEngine
from ctaAlgo.uiStrategyWindow import *
#----------------------------------------------------------------------
def main():
"""主程序入口"""
# 设置底部任务栏图标,win7以下请注释掉
try:
ctypes.windll.shell32.SetCurrentProcessExpl... | 1.90625 | 2 |
notes/code/sfpd/histo.py | skrilladeville/msds692 | 87 | 27229 | import sys
from csvcols import get_column
categories = get_column(sys.argv[1], col=1)
descriptions = get_column(sys.argv[1], col=2)
for c, n in categories.most_common(len(categories)):
print("%6d %s" % (n, c))
for d, n in descriptions.most_common(len(descriptions)):
print("%6d %s" % (n, d))
| 3.09375 | 3 |
autopatch/target_finder.py | Hydrogen-OS-P/tools | 2 | 27230 | <gh_stars>1-10
#!/usr/bin/python2
# Filename: target_finder.py
"""
Fast search the target out.
Usage: target_finder.py TARGET
- TARGET target path relative to current directory.
"""
__author__ = '<EMAIL>'
import sys
import re
import os
import fnmatch
import commands
class TargetFinder:
# The framewor... | 2.65625 | 3 |
geotrek/flatpages/serializers.py | pierreloicq/Geotrek-admin | 50 | 27231 | <filename>geotrek/flatpages/serializers.py<gh_stars>10-100
from rest_framework import serializers as rest_serializers
from geotrek.flatpages import models as flatpages_models
from geotrek.common.serializers import (
TranslatedModelSerializer, BasePublishableSerializerMixin,
RecordSourceSerializer, TargetPortal... | 1.65625 | 2 |
examples/docs_snippets/docs_snippets/overview/modes_resources/pipeline_with_modes.py | bitdotioinc/dagster | 2 | 27232 | from dagster import ModeDefinition, pipeline
from .database_resources import postgres_database, sqlite_database
from .solids_with_resources import generate_table_1, generate_table_2
@pipeline(
mode_defs=[
ModeDefinition("local_dev", resource_defs={"database": sqlite_database}),
ModeDefinition("pr... | 1.882813 | 2 |
tests/robot/test_files/py2.py | tiobe/modernize | 0 | 27233 | <filename>tests/robot/test_files/py2.py
# This file is part of krakenex.
#
# krakenex is free software: you can redistribute it and/or modify it
# under the terms of the GNU Lesser General Public License as published
# by the Free Software Foundation, either version 3 of the License, or
# (at your option) any later ver... | 2.484375 | 2 |
apostello/migrations/0007_auto_20160315_1213.py | LaudateCorpus1/apostello | 69 | 27234 | # -*- coding: utf-8 -*-
# Generated by Django 1.9.4 on 2016-03-15 12:13
from __future__ import unicode_literals
import django.core.validators
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [("apostello", "0006_userprofile_show_tour")]
operations = [
m... | 1.945313 | 2 |
bridle/const_expr.py | iguessthislldo/avidly | 1 | 27235 | <reponame>iguessthislldo/avidly
import enum
import operator as pyop
from abc import ABC, abstractmethod
from collections.abc import Callable
from typing import Any, Optional
import inspect
import string
from dataclasses import dataclass
from typing import TYPE_CHECKING
from .errors import ConstExprError, InternalError... | 2.25 | 2 |
pysmock/models/Info.py | pysmock/pysmock-codegen | 0 | 27236 | from yaml import YAMLObject
from . import Contact, License
class Info(YAMLObject):
yaml_tag = u'info'
def __init__(self,name: str ="",title: str = "", description: str = "",termsOfService: str = "",
contact: Contact = None, license: License = None, version: str = "1.0.0"):
self.name = name
self.title = ... | 2.828125 | 3 |
sites/de/zdf.py | eminga/simplEPG | 2 | 27237 | # -*- coding: utf-8 -*-
#
# Copyright (c) 2018 eminga
# Licensed under MIT License
import datetime, pytz, re, helper
def grab(channel, timespan):
tz = pytz.timezone("Europe/Berlin")
now = datetime.datetime.now(tz)
shows = []
a = 0
if now.time().hour < 7:
a = -1
for i in range(a, 14):
date = now + datetime.... | 2.6875 | 3 |
algorithms/warmup/compare-the-triplets.py | PingHuskar/hackerrank | 41 | 27238 | <reponame>PingHuskar/hackerrank<filename>algorithms/warmup/compare-the-triplets.py
# Algorithms > Warmup > Compare the Triplets
# Compare the elements in two triplets.
#
# https://www.hackerrank.com/challenges/compare-the-triplets/problem
#
a = map(int, input().split())
b = map(int, input().split())
alice, b... | 3.90625 | 4 |
app/__init__.py | cca/libraries_syllabus_notifications | 0 | 27239 | # @TODO we want to "from .app import main" so the test suite can import the
# main() function but if we do that then app.py throws errors when importing
# from config.py & its other dependencies
from .has_syllabus import *
| 1.296875 | 1 |
sdk/notificationhubs/azure-mgmt-notificationhubs/azure/mgmt/notificationhubs/models/__init__.py | rsdoherty/azure-sdk-for-python | 2,728 | 27240 | <reponame>rsdoherty/azure-sdk-for-python
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R... | 1.335938 | 1 |
utils/util.py | gmshashank/Deep_Flow_Prediction | 0 | 27241 | from genericpath import exists
import math
import numpy as np
import os
import re
from PIL import Image
import matplotlib.pyplot as plt
from matplotlib import cm
# append line to log file
def log(file, line, doPrint=True):
f = open(file, "a+")
f.wrtite(line + "\n")
f.close()
if doPrint:
print(l... | 2.375 | 2 |
tests/data/pdf_download_data.py | dbbabcock/BOE_tabulator | 1 | 27242 | from .sample_boe_page import HTML_TEXT
# static sample of html text used for testing, scraped from
# https://comptroller.baltimorecity.gov/boe/meetings/minutes
SAMPLE_HTML = HTML_TEXT
# Example set of expected year links pulled from HTML_TEXT
YEAR_LINKS = {
"2020": "/minutes-2020",
"2019": "/2019",
"2018"... | 1.8125 | 2 |
Fib Surname.py | Gerrydh/C-S-Exercises | 0 | 27243 | <reponame>Gerrydh/C-S-Exercises
# <NAME>, 30.01.2018
# A program that displays Fibonacci numbers.
def fib(n):
"""This function returns the nth Fibonacci numbers."""
i = 0 # variable i = the first fibonacci number
j = 1 # variable j = the second fibonacci number
n = n - 1 # variable n = n - 1
while n >= 0: #... | 4 | 4 |
tools/rest_integration_test.py | osrf/cloudsim-legacy | 0 | 27244 | #!/usr/bin/env python
from __future__ import print_function
import os
import sys
import unittest
import time
import datetime
import logging
from cloudsim_rest_api import CloudSimRestApi
import traceback
# add cloudsim directory to system path
basepath = os.path.abspath(os.path.join(os.path.dirname(__file__), '..'))
... | 2.140625 | 2 |
test/test_p4lib_delete.py | Tech-pandit/python-p4lib | 0 | 27245 | #!/usr/bin/env python
# Copyright (c) 2002-2005 ActiveState Corp.
# See LICENSE.txt for license details.
# Author:
# <NAME> (<EMAIL>)
# Home:
# http://trentm.com/projects/px/
"""Test p4lib.py's interface to 'p4 delete'."""
import os
import sys
import unittest
import types
import pprint
import testsupport
from p4... | 2.546875 | 3 |
src/infra/repo/base.py | gntzh/fastapi-tmpl | 0 | 27246 | from typing import Any, Generic, Protocol, Type, TypeVar
from loguru import logger
from sqlalchemy import select, func
from sqlalchemy.ext.asyncio import AsyncSession
class ModelBase(Protocol):
id: Any
def __init__(*args, **kwargs):
...
T = TypeVar("T")
ModelT = TypeVar("ModelT", bound=ModelBase)... | 2.390625 | 2 |
shaping.py | kotikkonstantin/convasr | 17 | 27247 | <filename>shaping.py
import functools
import typing
import torch
# equal to 1T
class _T(torch.Tensor):
pass
class BY(torch.Tensor):
pass
class T(torch.Tensor):
pass
class B(torch.Tensor):
pass
class S(torch.Tensor):
pass
class BCT(torch.Tensor):
pass
class CT(torch.Tensor):
pass
class BCt(torch.Tensor):
... | 2.34375 | 2 |
snmp/simple_snmp.py | gahlberg/pynet_class_work | 0 | 27248 | #!/usr/bin/env python
from snmp_helper import snmp_get_oid,snmp_extract
COMMUNITY_STRING = 'galileo'
SNMP_PORT = 7961
IP = '172.16.58.3'
a_device = (IP, COMMUNITY_STRING, SNMP_PORT)
OID = '1.3.6.1.2.1.1.1.0'
snmp_data = snmp_get_oid(a_device, oid=OID)
output = snmp_extract(snmp_data)
print output
| 2.546875 | 3 |
titanic2.py | kyzoon/kaggle_titanic | 0 | 27249 | <reponame>kyzoon/kaggle_titanic<filename>titanic2.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
__author__ = 'preston.zhu'
import numpy as np
import pandas as pd
import re
import operator
from sklearn.ensemble import RandomForestClassifier, ExtraTreesRegressor
import pdb
def get_title(name):
# 正则表达式搜索,搜索到如' Mr.... | 2.59375 | 3 |
genericCode/sortingAlgorithms/CountingSort.py | tejasnikumbh/Algorithms | 8 | 27250 | '''
Normal Counting sort without any associated array to keep track of
Time Complexity = O(n)
Space Complexity = O(n + k)
Auxilary Space = O(k)
'''
def countingSort(a):
b = [0]*(max(a) + 1)
c = []
for i in range(len(a)):
b[a[i]] += 1
for i in range(len(b)):
if(b[i] != 0)... | 3.734375 | 4 |
src/td/auth.py | annihilatorrrr/opentele | 30 | 27251 | from __future__ import annotations
from .configs import *
from . import shared as td
import hashlib
# if TYPE_CHECKING:
# from ..opentele import *
class AuthKeyType(IntEnum):
"""
Type of `AuthKey`
### Attributes:
Generated (`IntEnum`):
Generated key
Temporary (`IntEnum`... | 2.390625 | 2 |
qingmi/utils/crypto.py | xiongxianzhu/qingmi | 20 | 27252 | <reponame>xiongxianzhu/qingmi
# coding: utf-8
"""
Qingmi's standard crypto functions and utilities.
"""
import hashlib
import hmac
import random
import time
import base64
def get_random_string(length=12,
allowed_chars='abcdefghijklmnopqrstuvwxyz'
'ABCDEFGHIJK... | 2.359375 | 2 |
chap3-3.py | mikidake/Ex3 | 0 | 27253 | <gh_stars>0
# Chapter3 Ex.3)
# Modification of 'Guess My Number'
# Guess My Number
#
# The computer picks a random number between 1 and 100
# The player tries to guess it and the computer lets
# the player know if the guess is too high, too low
# or right on the money
# The player can try to guess up to three... | 4.3125 | 4 |
setup.py | enthought/etsproxy | 3 | 27254 | <reponame>enthought/etsproxy
from setuptools import setup, find_packages
version = '0.1.2'
setup(
name = 'etsproxy',
version = version,
description = 'proxy modules for backwards compatibility',
long_description = open('README.rst').read(),
packages = find_packages(),
author = 'Enthought, In... | 1.25 | 1 |
VSCode_work/chapter5/chapter5_5_5.py | yangyahu-1994/Python-Crash-Course | 12 | 27255 | <reponame>yangyahu-1994/Python-Crash-Course
# 创建变量,外星人为绿色
alien_color = 'green'
# 条件判断
if alien_color == 'green':
print("You get 5 points.")
elif alien_color == 'yellow':
print("\nYou get 10 points.")
else:
print("\nYou get 15 points.")
# 创建变量,外星人为黄色
alien_color = 'yellow'
# 条件判断
if alien_color == 'green... | 3.875 | 4 |
openpype/modules/ftrack/event_handlers_server/action_tranfer_hierarchical_values.py | Tilix4/OpenPype | 1 | 27256 | <reponame>Tilix4/OpenPype
import copy
import json
import collections
import ftrack_api
from openpype_modules.ftrack.lib import (
ServerAction,
statics_icon,
)
from openpype_modules.ftrack.lib.avalon_sync import create_chunks
class TransferHierarchicalValues(ServerAction):
"""Transfer values across hiera... | 2.0625 | 2 |
cyan/util/_enum.py | huajitech/cyan | 5 | 27257 | <reponame>huajitech/cyan<filename>cyan/util/_enum.py
from enum import EnumMeta
from typing import Any
def get_enum_key(enum: EnumMeta, value: Any, default: Any = ...) -> Any:
"""
获取 `Enum` 值对应的键。
参数:
- enum: Enum 类型
- value: 将要查询对应键的值
- default: 当对应键不存在时返回的默认值(默认返回传入的 `value` 参数)
... | 2.609375 | 3 |
test/test_ean.py | blazaid/pycodes | 0 | 27258 | <filename>test/test_ean.py
from unittest import TestCase
from pycodes.ean import Ean13
from pycodes.exceptions import EmptyCode, CharacterNotAllowed, BadCodeLength, \
WrongChecksum
class Ean13TestCase(TestCase):
def setUp(self):
self.valid_codes = (
'0000000000000',
'111111111... | 3.09375 | 3 |
storage_cost_analysis.py | akosfenyvesi/FobSimApp | 0 | 27259 | import os
from pandas import DataFrame
import time
times = [0]
sizes = [0]
run_time_seconds = 200
def run_storage_analysis():
path = 'temporary'
# initialize the size\
total_size = 0
# use the walk() method to navigate through directory tree
for dirpath, dirnames, filenames in os.wa... | 3.203125 | 3 |
conda_forge_tick/mamba_solver.py | Prodyte/cf-scripts | 0 | 27260 | <filename>conda_forge_tick/mamba_solver.py
"""This module has code to use mamba to test if a given package can be solved.
The basic workflow is for yaml file in .ci_support
1. run the conda_build api to render the recipe
2. pull out the host/build and run requirements, possibly for more than one output.
3. send them ... | 2.703125 | 3 |
student_core/urls.py | michaelchen-lab/LMS_Backend | 0 | 27261 | <reponame>michaelchen-lab/LMS_Backend
from django.urls import path, include
from rest_framework.routers import DefaultRouter
from student_core.views import *
# Create a router and register our viewsets with it.
router = DefaultRouter()
router.register(r'initial', StudentInitialViewSet, basename="student_initial")
rout... | 2.59375 | 3 |
core/database/generator.py | xorond/l0l | 6 | 27262 | <gh_stars>1-10
#------------------Bombermans Team---------------------------------#
#Author : B3mB4m
#Concat : <EMAIL>
#Project : https://github.com/b3mb4m/Shellsploit
#LICENSE : https://github.com/b3mb4m/Shellsploit/blob/master/LICENSE
#------------------------------------------------------------------#
def generat... | 2.265625 | 2 |
bugtests/test286c.py | doom38/jython_v2.2.1 | 0 | 27263 | """
Test multilevel overriding of java methods in jythonc.
"""
from java.util import Date
class SubDate(Date):
def toString(self):
s = Date.toString(self)
return 'SubDate -> Date'
class SubSubDate(SubDate):
def toString(self):
return 'SubSubDate -> ' + SubDate.toString(self)
asser... | 3.5625 | 4 |
segmentation/utils/converter.py | enjoy-the-science/brain-texts | 0 | 27264 | <reponame>enjoy-the-science/brain-texts<gh_stars>0
import warnings
import sys
if not sys.warnoptions:
warnings.simplefilter("ignore")
from segmentation.utils.DataReader import DataReader
import argparse
import glob
import os
def arguments():
parser = argparse.ArgumentParser()
parser.add_argument("-i", "... | 2.515625 | 3 |
bomber/views.py | acdh-oeaw/DAAC-DB | 0 | 27265 | <reponame>acdh-oeaw/DAAC-DB
from django.shortcuts import render
from django_tables2 import RequestConfig
from django.views.generic.detail import DetailView
from django.db.models import Count
from crew.models import Person
from .models import Bomber
from .tables import BomberTable
def bomber(request):
table = Bom... | 2.078125 | 2 |
BOJ/14000~14999/14471.py | shinkeonkim/today-ps | 2 | 27266 | n,m=map(int,input().split())
L = [list(map(int,input().split())) for i in range(m)]
ans = 0
L.sort(key = lambda t:t[0],reverse = True)
for i in L[:-1]:
ans += max(0,n-i[0])
print(ans) | 2.578125 | 3 |
libra/discovery_set.py | Xing-Huang/libra-client | 0 | 27267 | <filename>libra/discovery_set.py
from canoser import Struct
from libra.account_config import AccountConfig
from libra.event import EventKey
class DiscoverySet(Struct):
_fields = []
DISCOVERY_SET_STRUCT_NAME = "DiscoverySet"
@classmethod
def change_event_key(cls):
return EventKey.ne... | 1.976563 | 2 |
dev_tools/scan_inclusions.py | frannuca/quantlib | 0 | 27268 | import os, sys, re, string
import xml.dom.minidom
import xml.dom.ext
QL_ROOT = "C:/Projects/QuantLibSVN/trunk/"
VC8 = "C:/Program Files/Microsoft Visual Studio 8/"
BOOST = "C:/Boost/boost_1_33_1/"
QL = QL_ROOT +"QuantLib/"
QL_ADDIN = QL_ROOT + "QuantLibAddin/"
OBJECT_HANDLER = QL_ROOT + "ObjectHandler/"
... | 2.421875 | 2 |
python/15_bsearch/bsearch_recursion.py | shipan3452/algo | 22,028 | 27269 | <reponame>shipan3452/algo
"""
Author: dreamkong
"""
from typing import List
def bsearch(nums: List[int], target: int) -> int:
return bsearch_internally(nums, 0, len(nums)-1, target)
def bsearch_internally(nums: List[int], low: int, high: int, target: int) -> int:
if low > high:
return -1
m... | 3.859375 | 4 |
ports/esp32/boards/METERBOARD32/modules/mbus/device.py | henriknelson/micropython | 1 | 27270 | from mbus.record import ValueRecord
from machine import RTC
import ubinascii
import random
import time
import re
class MBusDevice:
"""Class that encapulates/emulates a single MBus device"""
def __init__(self, primary_address, secondary_address, manufacturer, meter_type):
self._primary_address = primary... | 3.046875 | 3 |
alphamind/model/data_preparing.py | rongliang-tech/alpha-mind | 186 | 27271 | # -*- coding: utf-8 -*-
"""
Created on 2017-8-24
@author: cheng.li
"""
import bisect
import datetime as dt
from typing import Iterable
from typing import Union
import numpy as np
import pandas as pd
from simpleutils.asserts import require
from PyFin.DateUtilities import Period
from PyFin.api import BizDayConventions... | 2.0625 | 2 |
AppleFluenza/__main__.py | fxrcha/AppleFluenza | 6 | 27272 | import logging
import sys
from AppleFluenza.bot import auto_load_cogs, bot
from utils.getenv import getenv
from utils.cli import header, option_parser
if __name__ == "__main__":
header()
auto_load_cogs(bot)
optparser = option_parser()
(options, args) = optparser.parse_args(sys.argv)
token = g... | 1.953125 | 2 |
tests/utils.py | data4help/shiny-bassoon | 0 | 27273 | # %% Packages
import os
import pickle
from pyhocon import ConfigTree
# %% Functions
def load_pickle(loading_path: str):
"""This method loads the file at the specified path
:param loading_path: Path at which object is saved
:type loading_path: str
:return: Desired file
:rtype: Could be basically... | 2.859375 | 3 |
chatbrick/brick/icn.py | BluehackRano/cb-wh | 0 | 27274 | import logging
import blueforge.apis.telegram as tg
import requests
from blueforge.apis.facebook import Message, ImageAttachment, QuickReply, QuickReplyTextItem, TemplateAttachment, \
GenericTemplate, Element, PostBackButton
from chatbrick.util import get_items_from_xml, UNKNOWN_ERROR_MSG
import time
logger = lo... | 2.21875 | 2 |
Monitoring/dht22_monitor.py | jpradass/Raspberry-Utils | 0 | 27275 | <reponame>jpradass/Raspberry-Utils
import time
import requests
INFLUX_URL = 'http://localhost:8086/write?db=DHT22'
def sendDataToGrafana(humidity, temp, pressure):
requests.post(INFLUX_URL, data='temperature value=' + str(temp))
requests.post(INFLUX_URL, data='humidity value=' + str(humidity))
requests.p... | 2.484375 | 2 |
compiler/parser/expression_models/comparison.py | Fire-Script/FireScript | 2 | 27276 | <reponame>Fire-Script/FireScript<filename>compiler/parser/expression_models/comparison.py
from compiler.bytecode.opcodes import OpCodes
from compiler.errors.errors import FTypeError
from compiler.parser.expressions import Expression
from typing import List, Dict
class EqualToExp(Expression):
"""
Syntax: (= a... | 2.578125 | 3 |
Echoes/Filezilla.py | xeddmc/BrainDamage | 1,520 | 27277 | # Based on the work of https://github.com/AlessandroZ/LaZagne/blob/master/Windows/lazagne/
import xml.etree.cElementTree as ET
import os, base64
class Filezilla():
def __init__(self):
options = {'command': '-f', 'action': 'store_true', 'dest': 'filezilla', 'help': 'filezilla'}
def run(self):
i... | 2.484375 | 2 |
flights/models.py | solnsubuga/flightapp | 0 | 27278 | from django.db import models
from django.contrib.auth.models import User
class Flight(models.Model):
STATUSES = (
('SCHEDULED', 'SCHEDULED'),
('DELAYED', 'DELAYED'),
('ON_TIME', 'ON TIME'),
('ARRIVED', 'ARRIVED'),
('LATE', 'LATE')
)
number = models.CharField(max_len... | 2.28125 | 2 |
look_w.py | kakkarja/english-words | 1 | 27279 | <gh_stars>1-10
import os
from pathlib import Path
# Geting users home directory
h_path = str(Path.home()) # + any addtional path to a folder that contain word.txt
# Change directory to h_path where words.txt is located
os.chdir(h_path)
# Open words.txt.
words = open('words.txt').read().split()
def look_w(word,num):... | 3.609375 | 4 |
libcity/model/trajectory_loc_prediction/SERM.py | moghadas76/test_bigcity | 221 | 27280 | <filename>libcity/model/trajectory_loc_prediction/SERM.py<gh_stars>100-1000
import torch
import torch.nn as nn
import numpy as np
from libcity.model.abstract_model import AbstractModel
from torch.nn.utils.rnn import pack_padded_sequence
from torch.nn.utils.rnn import pad_packed_sequence
class EmbeddingMatrix(nn.Modul... | 2.265625 | 2 |
not_used/jobs_to_csv.py | oaklandanalytics/parcel_cutting_board | 0 | 27281 | import geopandas as gpd
# not used anymore - converts esri jobs shapefile to a csv
# see assign_jobs_lat_lng.py
gdf = gpd.GeoDataFrame.from_file("est10_esri_gt1.shp")
gdf = gdf.to_crs(epsg=4326)
fname_map = {
'Duns_Numbe': 'duns_number',
'Business_N': 'business_name',
'Emp_Total': 'total_employment',
... | 2.75 | 3 |
sentence_generator.py | gabrielilharco/sentence-generator | 5 | 27282 | import argparse
import random
import operator
import os
def parse_grammar(file_path):
"""
Generate a grammar from a file describing the production rules.
Note that the symbols are inferred from the production rules.
For more information on the format of the file, please reffer to
the README.md or the the sample ... | 4 | 4 |
student_paulo.py | IgaoGuru/Csgo-NeuralNetwork | 2 | 27283 | #TODO: use only one (RGB) channel
import numpy as np
import pandas as pd
import os
from torch.utils import data
from torch.utils.data.dataloader import DataLoader as DataLoader
import torch
from torchvision import transforms
from natsort import natsorted, ns
import cv2
from PIL import Image
import matplotlib.pyplot as ... | 2.46875 | 2 |
tests/deeply/test_exception.py | achillesrasquinha/deeply | 2 | 27284 | # imports - module imports
from deeply.exception import (
DeeplyError
)
# imports - test imports
import pytest
def test_deeply_error():
with pytest.raises(DeeplyError):
raise DeeplyError | 1.882813 | 2 |
test/common.py | philippe-goetz/python-jwt | 0 | 27285 | """ Common setup and patching for tests """
#pylint: disable=wrong-import-order
from datetime import datetime as orig_datetime, timedelta
from mock import patch
import threading
#pylint: disable=W0401,W0614
from test.fixtures import *
_thread_state = threading.local()
def _new_utcnow():
""" Return last set datet... | 2.34375 | 2 |
modules/bot_oc.py | opencitations/telegrambot | 1 | 27286 | <reponame>opencitations/telegrambot
my_commands = {
"/contact" : {"notes":" Retrieve all the accounts (email, Twitter, GitHub, etc.) to contact the OpenCitations folks", 'parse_mode':'Markdown'},
"/ask" : {"notes":"Params: <DOI>. Retrieve information about the entity identified by the input DOI (source: COCI)"... | 2.59375 | 3 |
WebFrameDocs/src/demo/fileStorage/script/genScaleMap.py | Bean-jun/LearnGuide | 1 | 27287 | """
A-Z: 65-90
a-z: 97-122
"""
dic = {}
n = 0
for i in range(10):
dic[n] = str(i)
n += 1
for i in range(65, 91):
dic[n] = chr(i)
n += 1
for i in range(97, 123):
dic[n] = chr(i)
n += 1
print(dic)
| 3.453125 | 3 |
src/dagian/tests/lifetime_feature_generator.py | ianlini/dagian | 11 | 27288 | <reponame>ianlini/dagian
from __future__ import print_function, division, absolute_import, unicode_literals
from io import StringIO
import dagian
from dagian import Argument as A
from dagian.decorators import (
require,
will_generate,
)
import numpy as np
import pandas as pd
from scipy.sparse import csr_matrix... | 2.421875 | 2 |
spyre/spyre/spyrelets/peaktrack_spyrelet.py | zhong-lab/code | 1 | 27289 | <gh_stars>1-10
import numpy as np
import pyqtgraph as pg
import matplotlib.pyplot as plt
import csv
import sys
from PyQt5.Qsci import QsciScintilla, QsciLexerPython
from PyQt5.QtWidgets import QPushButton, QTextEdit, QVBoxLayout
import time
import random
import os
from spyre import Spyrelet, Task, Element
fr... | 2.09375 | 2 |
cdpybio/general.py | cdeboever3/cdpybio | 2 | 27290 | import re
import numpy as np
import pandas as pd
import scipy.stats as stats
R_REGEX = re.compile('(.*):(.*)-(.*)')
R_REGEX_STRAND = re.compile('(.*):(.*)-(.*):(.*)')
def chunks(l, n):
"""Yield successive n-sized chunks from l."""
# https://stackoverflow.com/questions/312443/how-do-you-split-a-list-into-even... | 3.0625 | 3 |
docs/doxygen/log.py | tkrupa-intel/openvino | 1 | 27291 | <reponame>tkrupa-intel/openvino<gh_stars>1-10
# ******************************************************************************
# Copyright 2017-2021 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... | 1.867188 | 2 |
rec_to_nwb/processing/nwb/components/electrodes/extension/fl_electrode_extension_manager.py | asilvaalex4/rec_to_nwb | 1 | 27292 | <filename>rec_to_nwb/processing/nwb/components/electrodes/extension/fl_electrode_extension_manager.py
import copy
import logging.config
import os
from rec_to_nwb.processing.exceptions.not_compatible_metadata import NotCompatibleMetadata
from rec_to_nwb.processing.header.module.header import Header
from rec_to_nwb.proc... | 1.898438 | 2 |
utils/prediction.py | ZhengLiangliang1996/Speech-Recogniton-Tool-Box | 0 | 27293 | <gh_stars>0
#! /usr/bin/env python
"""
Author: <NAME>
Date:
File Description
"""
import sys
import time
import os
sys.path.append('..')
from __future__ import print_function
import sys
import argparse
from keras import backend as K
from utils.cha_level_helper import output_sequence
import numpy as np
#TODO: still ne... | 2.484375 | 2 |
smq/plot.py | x75/smq | 0 | 27294 | import numpy as np
import matplotlib.pyplot as pl
import pandas as pd
import seaborn as sns
import smq.logging as log
# check pandas, seaborne
# FIXME: fix hardcoded tablenames
from smq.utils import set_attr_from_dict
def get_data_from_item_log(items):
tbl_key = items[0].name
# print "%s.run: tbl_key = %s" ... | 2.359375 | 2 |
test/model/test_pddl_action_representation.py | DLR-RM/rafcon-task-planner-plugin | 1 | 27295 | <gh_stars>1-10
from rafcontpp.model.pddl_action_representation import PddlActionRepresentation
from rafcontpp.model.pddl_action_representation import action_to_upper
def test_action_to_upper():
#arrange
action = PddlActionRepresentation('myAction','(action:)',['(at ?a - Object)'],['Object'],[':strips'],['param... | 2.5 | 2 |
awsume/awsumepy/app.py | icyfork/awsume | 0 | 27296 | import os
import sys
import argparse
import difflib
import json
import logging
import pluggy
import colorama
import boto3
from pathlib import Path
from . lib.autoawsume import create_autoawsume_profile
from ..autoawsume.process import kill, kill_autoawsume
from . lib.profile import aggregate_profiles, get_role_chain, ... | 1.90625 | 2 |
mtkclient/gui/toolsMenu.py | P-Salik/mtkclient | 0 | 27297 | <gh_stars>0
from PySide6.QtCore import Slot, QObject, Signal
from PySide6.QtWidgets import QTableWidget, QTableWidgetItem
from mtkclient.gui.toolkit import trap_exc_during_debug, asyncThread, FDialog
from mtkclient.Library.mtk_da_cmd import DA_handler
import os
import sys
import json
sys.excepthook = trap_exc_during_de... | 1.851563 | 2 |
Semenenya_Vladislav_dz_2/task_2_3.py | neesaj/1824_GB_Python_1 | 0 | 27298 | <filename>Semenenya_Vladislav_dz_2/task_2_3.py
lst = ['инженер-конструктор Игорь', 'главный бухгалтер МАРИНА', 'токарь высшего разряда нИКОЛАй', 'директор аэлита']
some_str = ''
i = 0
for elem in lst:
some_str = elem
lst[i] = some_str.split()
some_str = ''
i += 1
for i in lst:
for j in range(len... | 3.6875 | 4 |
mooc.py | fichas/Down_Mooc | 18 | 27299 | <reponame>fichas/Down_Mooc
# -*- coding: utf-8 -*-
import re
import sys
import os
import requests
headers = {'Referer':'http://d0.ananas.chaoxing.com/','User-Agent': 'User-Agent:Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/56.0.2924.87 Safari/537.36'}
url=sys... | 2.8125 | 3 |