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 |
|---|---|---|---|---|---|---|
hw-appium/page_object/testcase/test_self_choice.py | ZitherPeng/CodeRecord_Python | 0 | 12777551 | import pytest
from page_object.page.MainPage import MainPage
class TestSelfChoice(object):
def test_price(self):
main = MainPage()
assert main.click_self_choice() | 1.882813 | 2 |
question_bank/permutation-i-lcci/permutation-i-lcci.py | yatengLG/leetcode-python | 9 | 12777552 | # -*- coding: utf-8 -*-
# @Author : LG
"""
执行用时:288 ms, 在所有 Python3 提交中击败了5.29% 的用户
内存消耗:20.6 MB, 在所有 Python3 提交中击败了33.22% 的用户
解题思路:
回溯
通过一个列表记录已经使用过的字符下标
"""
class Solution:
def permutation(self, S: str) -> List[str]:
n = len(S)
result = []
def backtrack(current, used):
... | 3.703125 | 4 |
wagtail_advanced_form_builder/forms/widgets/side_by_side_radio_select_widget.py | octavenz/wagtail-advanced-form-builder | 11 | 12777553 | from django.forms import RadioSelect
class SideBySideRadioSelectWidget(RadioSelect):
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self.display_side_by_side = True
| 2.046875 | 2 |
stsdas/pkg/hst_calib/nicmos/runcalsaa.py | iraf-community/stsdas | 1 | 12777554 | #! /usr/bin/env python
"""
runcalsaa.py - Module to perform SAA correction in the CALNIC pipeline
(After CALNICA, before CALNICB) by running the PEDSUB, BEP, and SAACLEAN tasks.
PEDSUB is run only to improve the calculations of the SAA persistence and BEP
signature; no pedestal correction is actually applied to the fin... | 1.859375 | 2 |
waves_gateway/storage/mongo_key_value_storage_impl.py | NeolithEra/WavesGatewayFramework | 25 | 12777555 | """
MongoKeyValueStorageImpl
"""
from waves_gateway.common import Injectable, KEY_VALUE_STORAGE_COLLECTION
from waves_gateway.model import PollingState
from waves_gateway.serializer import PollingStateSerializer
from waves_gateway.storage.key_value_storage import KeyValueStorage
from pymongo.collection import Collectio... | 2.34375 | 2 |
tests/test_api.py | ignpelloz/fuji | 25 | 12777556 | # -*- coding: utf-8 -*-
"""
A collection of tests to test the reponses of a Fask tesk fuji client,
i.e. if the app is working and there are no swagger problems.
"""
def test_ui(fujiclient):
"""Basic smoke test to see if app is buildable"""
response = fujiclient.get('/fuji/api/v1/ui/')
print(response.data)... | 2.40625 | 2 |
toga/optimization_state/datadict.py | JPLMLIA/TOGA | 0 | 12777557 | """
Author: <NAME>
Date : 12/4/19
Brief : Handles the pareto frontier dictionary updates and accessing
Notes :
Copyright 2019 California Institute of Technology. ALL RIGHTS RESERVED.
U.S. Government Sponsorship acknowledged.
"""
import collections
from collections import Mapping
import copy
import json
import num... | 2.3125 | 2 |
metaworld/envs/gym_UR3/example/mujoco/ur3_gripper_test.py | dscho1234/metaworld | 0 | 12777558 | import gym
import numpy as np
from gym_UR3.envs.mujoco import MujocoUR3Env
import time
def main():
env = gym.make('UR3-v0')
Da = env.action_space.shape[0]
obs=env.reset()
start = time.time()
for i in range(100):
env.reset()
print('{}th episode'.format(i+1))
for j i... | 2.6875 | 3 |
eth2/beacon/types/blocks.py | hwwhww/trinity | 2 | 12777559 | <gh_stars>1-10
from abc import (
ABC,
abstractmethod,
)
from typing import (
Sequence,
TYPE_CHECKING,
)
from eth_typing import (
BLSSignature,
Hash32,
)
from eth_utils import (
encode_hex,
)
import ssz
from ssz.sedes import (
List,
bytes32,
bytes96,
uint64,
)
from eth._u... | 2.15625 | 2 |
astronet/astronet/data/generate_kepler_subset.py | ch8644760/models | 2 | 12777560 | # Written by <NAME> (GitHub: OneAndOnlySeabass) 15-10-2018
# This script generates a stratified random subset of n size from a Kepler TCE csv.
import pandas as pd
import numpy as np
# Adjustable variables can be changed here
read_loc = #r"tce csv location"
pc_subset = 1000
fp_subset = 1000 # Both AFPs and NTPs
write_... | 2.796875 | 3 |
testMath.py | SLongofono/448_Project3 | 0 | 12777561 | import os,sys,inspect
currentdir = os.path.dirname(os.path.abspath(inspect.getfile(inspect.currentframe())))
parentdir = os.path.dirname(currentdir)
sys.path.insert(0,parentdir)
import Variance
import math
def testVariance():
print ("1. Testing Variance")
weighting = [2,2,2,2,2,2,2,2,2,2]
test1 = [['artist1', 'ar... | 2.90625 | 3 |
skp_edu_docker/code/tfrest/celery.py | TensorMSA/hoyai_docker | 8 | 12777562 | <gh_stars>1-10
from __future__ import absolute_import, unicode_literals
import os
from celery import Celery
import logging
from django.conf import settings
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'tfrest.settings')
app = Celery('tfrest')
app.config_from_object('django.conf:settings')
app.autodiscover_tasks(la... | 1.6875 | 2 |
variable_and_data_type/string_demo/string_concatenation.py | pysga1996/python-basic-programming | 0 | 12777563 | <gh_stars>0
# To concatenate, or combine, two strings you can use the + operators.
a = "Hello"
b = "World"
c = a + b
print(c)
a = "Hello"
b = "World"
c = a + " " + b
print(c)
| 3.921875 | 4 |
quickstart-jython/src/main/java/org/quickstart/jython/calculator_func.py | youngzil/quickstart-framework | 6 | 12777564 | <gh_stars>1-10
# coding=utf-8
import math
# 面向函数式编程
def power(x, y):
return math.pow(x, y) | 2.28125 | 2 |
tests/test_portfolio_handler.py | ivanliu1989/qstrader | 113 | 12777565 | import datetime
from decimal import Decimal
import unittest
from qstrader.event import FillEvent, OrderEvent, SignalEvent
from qstrader.portfolio_handler import PortfolioHandler
from qstrader.price_handler.base import AbstractTickPriceHandler
from qstrader.compat import queue
class PriceHandlerMock(AbstractTickPrice... | 2.828125 | 3 |
tick_track/src/helpers/time.py | dmenezesgabriel/tick_track | 0 | 12777566 | <gh_stars>0
import datetime
import pytz
def now():
"""
Returns UTC timestamp with time zone
"""
return pytz.UTC.localize(datetime.datetime.utcnow())
def now_br():
"""
Returns America - São Paulo timestamp with time zone
"""
return now().astimezone(pytz.timezone("America/Sao_Paulo"))
... | 3.125 | 3 |
systematicity.py | adamdotdev/font-systematicity | 1 | 12777567 | <reponame>adamdotdev/font-systematicity<filename>systematicity.py
import io
from itertools import combinations
import json
from typing import NamedTuple
import numpy as np
from scipy.stats.stats import pearsonr
from peewee import DoesNotExist
import data
from data import Font, GlyphSet, Glyph, SoundDistance, ShapeDis... | 2.703125 | 3 |
taln2016/icsisumm-primary-sys34_v1/nltk/nltk-0.9.2/nltk/corpus/reader/string_category.py | hectormartinez/rougexstem | 0 | 12777568 | # Natural Language Toolkit: String Category Corpus Reader
#
# Copyright (C) 2001-2008 University of Pennsylvania
# Author: <NAME> <<EMAIL>>
# <NAME> <<EMAIL>>
# URL: <http://nltk.sf.net>
# For license information, see LICENSE.TXT
"""
Read tuples from a corpus consisting of categorized strings.
For example, fro... | 3.515625 | 4 |
tests/resource/test_uriquote.py | ekoka/halo | 0 | 12777569 | <reponame>ekoka/halo
from halo.resource import URIEncode
def test_can_encode_uri():
urq = URIEncode()
decoded = 'foo and bar/{baz}'
encoded = 'foo%20and%20bar/%7bbaz%7d'
assert urq.enc(decoded).uri==encoded
def test_can_accept_plain_strings():
ur = URIEncode('abc')
assert ur.plain(': and :').u... | 2.4375 | 2 |
mod_custom.py | shariqmalik/seeker | 1 | 12777570 | <gh_stars>1-10
#!/usr/bin/env python3
R = '\033[31m' # red
G = '\033[32m' # green
C = '\033[36m' # cyan
W = '\033[0m' # white
old = input(G + '[+]' + C + ' Do you want to reuse previous configs? (Y/N) : ' + W)
if old.lower() != 'y':
redirect = input(G + '[+]' + C + ' Enter Target URL (YouTube,Blog etc) : ' + W... | 2.390625 | 2 |
eazy/igm.py | albertfxwang/eazy-py | 20 | 12777571 | import os
import numpy as np
from . import __file__ as filepath
__all__ = ["Inoue14"]
class Inoue14(object):
def __init__(self, scale_tau=1.):
"""
IGM absorption from Inoue et al. (2014)
Parameters
----------
scale_tau : float
Parameter multiplied to t... | 2.5625 | 3 |
hex2file/hex2file.py | mattixtech/hex2file | 0 | 12777572 | <reponame>mattixtech/hex2file
"""
hex2file.py
<NAME>, 2018
Utility for writing hex to a file.
"""
import argparse
import binascii
import deprecation
import sys
def _sanitize(hex_str, comment_strings=None, ignore_strings=None):
"""
Sanitize string input before attempting to write to file.
:param hex_str:... | 3.578125 | 4 |
main/config/management/commands/download_geolite.py | TunedMystic/url-shortener | 0 | 12777573 | <gh_stars>0
import gzip
import os
import shutil
import urllib
from django.conf import settings
from django.core.management.base import BaseCommand
class Command(BaseCommand):
help = 'Download the geolite binaries and store in GEOIP_PATH'
def download_and_extract_file(self, item):
filename = item.get... | 2.21875 | 2 |
lib/Utils/fitnessmatrixuploadUtilClient.py | OGalOz/poolfileupload | 0 | 12777574 | <gh_stars>0
import os
import logging
import re
import shutil
import datetime
import pandas as pd
from installed_clients.DataFileUtilClient import DataFileUtil
from installed_clients.WorkspaceClient import Workspace
class fitnessmatrixuploadUtil:
def __init__(self, params):
self.params = params
sel... | 2.390625 | 2 |
main.py | mthompson-lab/xray_thermometer | 0 | 12777575 | <gh_stars>0
import subprocess
directory = "/reg/d/psdm/mfx/mfxo1916/scratch/tmp_training/results/r0020/000_rg001/out/debug"
print set(line.strip() for line in subprocess.check_output("sh generate_hitlist.sh {}".format(directory), shell=True).split())
log_direct = '/reg/d/psdm/mfx/mfxo1916/scratch/tmp_training/results... | 2.203125 | 2 |
tests/timstamp.py | zibous/ha-miscale2 | 25 | 12777576 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
import sys
sys.path.append("..")
try:
from datetime import datetime, timezone
import pytz
except Exception as e:
print('Import error {}, check requirements.txt'.format(e))
sys.exit(1)
DATEFORMAT_MISCAN = '%Y-%m-%d %H:%M:%S'
DATEFORMAT_UTC = '%Y-%m-%dT%... | 2.765625 | 3 |
mayan/apps/sources/handlers.py | garrans/mayan-edms | 0 | 12777577 | from __future__ import unicode_literals
from django.utils.translation import ugettext_lazy as _
from converter.models import Transformation
from .literals import SOURCE_UNCOMPRESS_CHOICE_ASK
from .models import POP3Email, IMAPEmail, WatchFolderSource, WebFormSource
def create_default_document_source(sender, **kwar... | 1.664063 | 2 |
day7.py | seblars/AdventOfCode2020 | 1 | 12777578 | import fileinput
import re
data = ''.join(fileinput.input()).split('\n')
def searchData(target):
return [d for d in data if re.search(target, d) is not None]
# part 1
targets = ['shiny gold']
searched = []
all_bags = []
converged = False
while not converged:
new_targets = []
for t in targe... | 3.171875 | 3 |
prodcal_ics.py | ffix/prodcal_ics | 26 | 12777579 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
from icalendar import Calendar, Event
from datetime import datetime, timedelta
from lxml import html
import requests
import argparse
import logging
import secrets
def get_holidays_grouped_by_months(year):
page = requests.get(
"http://www.consultant.ru/law/re... | 2.828125 | 3 |
AItest.py | owattenmaker/PythonFighter | 0 | 12777580 | <gh_stars>0
import pygame
import random
from pygame.locals import *
pygame.init()
screen=pygame.display.set_mode((640,480))
clock=pygame.time.Clock()
px=35
py=35
prect=pygame.Rect(px-10,py-10,20,20)
class Enemy(object):
def __init__(self,x,y):
self.x=x
self.y=y
self.rad=random.randint(5,10)
self.rect=pygame... | 3.28125 | 3 |
tests/geometry/test_utm.py | jhonykaesemodel/av2-api | 26 | 12777581 | <filename>tests/geometry/test_utm.py
# <Copyright 2022, Argo AI, LLC. Released under the MIT license.>
"""Unit tests on utilities for converting AV2 city coordinates to UTM or WGS84 coordinate systems."""
import numpy as np
import av2.geometry.utm as geo_utils
from av2.geometry.utm import CityName
from av2.utils.typ... | 2.5625 | 3 |
Lessons/source/strings.py | jayceazua/CS-1.3-Core-Data-Structures | 0 | 12777582 | <reponame>jayceazua/CS-1.3-Core-Data-Structures
#!python
def contains(text, pattern):
"""Return a boolean indicating whether pattern occurs in text."""
assert isinstance(text, str), 'text is not a string: {}'.format(text)
assert isinstance(pattern, str), 'pattern is not a string: {}'.format(text)
# TOD... | 4.03125 | 4 |
plugins/sed.py | martinkirch/tofbot | 1 | 12777583 | <reponame>martinkirch/tofbot<filename>plugins/sed.py<gh_stars>1-10
# This file is part of tofbot, a friendly IRC bot.
# You may redistribute it under the Simplified BSD License.
# If we meet some day, and you think this stuff is worth it,
# you can buy us a beer in return.
#
# Copyright (c) 2011 <NAME> <<EMAIL>>
"See ... | 2.359375 | 2 |
yahoo_finance_pynterface/__init__.py | mellon85/yahoo-finance-pynterface | 15 | 12777584 | <filename>yahoo_finance_pynterface/__init__.py
#!/usr/bin/env python
#
# Yahoo Finance Python Interface
# https://github.com/andrea-dm/yahoo-finance-pynterface
#
# Copyright (c) 2018 <NAME>
#
# MIT License
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated... | 1.609375 | 2 |
Easy/392. Is Subsequence/solution (3).py | czs108/LeetCode-Solutions | 3 | 12777585 | # 392. Is Subsequence
# Runtime: 28 ms, faster than 90.94% of Python3 online submissions for Is Subsequence.
# Memory Usage: 14.2 MB, less than 74.36% of Python3 online submissions for Is Subsequence.
class Solution:
# Two Pointers
def isSubsequence(self, s: str, t: str) -> bool:
left, right = 0, 0
... | 3.671875 | 4 |
sarpy/io/complex/other_nitf.py | ngageoint/SarPy | 0 | 12777586 | """
Work in progress for reading some other kind of complex NITF.
"""
__classification__ = "UNCLASSIFIED"
__author__ = "<NAME>"
import logging
from typing import Union, Tuple, List, Optional, Callable, Sequence
import copy
from datetime import datetime
import numpy
from scipy.constants import foot
from sarpy.geomet... | 1.773438 | 2 |
babble/__init__.py | billchenxi/babble | 130 | 12777587 | from .explanation import Explanation
from .parsing import Rule, Grammar, Parse, SemanticParser
from .filter_bank import FilterBank
from .utils import ExplanationIO, link_explanation_candidates
from .babbler import Babbler, BabbleStream | 0.980469 | 1 |
medium/129_sum_root_to_leaf_nodes.py | Sukhrobjon/leetcode | 0 | 12777588 | # Definition for a binary tree node.
class TreeNode(object):
def __init__(self, x):
self.val = x
self.left = None
self.right = None
class Solution(object):
def sumNumbers(self, root):
"""
:type root: TreeNode
:rtype: int
"""
all_path = []
... | 3.984375 | 4 |
airobot/ee_tool/simple_gripper_mimic_pybullet.py | rhett-chen/airobot | 51 | 12777589 | import threading
import time
import airobot.utils.common as arutil
from airobot.ee_tool.simple_gripper_pybullet import SimpleGripperPybullet
from airobot.utils.arm_util import wait_to_reach_jnt_goal
class SimpleGripperMimicPybullet(SimpleGripperPybullet):
"""
A base class for gripper with mimic joints in pyb... | 2.375 | 2 |
old/Agent.py | Leonard1904/reinforcement-learning | 0 | 12777590 | <filename>old/Agent.py
import threading
import gym
import time
import cv2
import numpy as np
from Network import Network
from scipy.misc import imresize
from scipy.signal import lfilter
class Memory:
def __init__(self):
self.states = []
self.actions = []
self.rewards = []
... | 2.3125 | 2 |
tools/accuracy_checker/accuracy_checker/representation/segmentation_representation.py | zhoub/dldt | 0 | 12777591 | """
Copyright (c) 2019 Intel Corporation
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,... | 2.171875 | 2 |
Website/forms.py | Astatine404/spiritus | 1 | 12777592 | <filename>Website/forms.py<gh_stars>1-10
from django import forms
from django.forms import ModelForm
from .models import Music
class MusicForm(forms.ModelForm):
video = forms.FileField(label='Video file')
class Meta:
model = Music
fields = {'video'} | 2.125 | 2 |
noxfile.py | larryturner/diamondback | 4 | 12777593 | <reponame>larryturner/diamondback<gh_stars>1-10
""" **Description**
Nox project management.
**Example**
::
nox --list
nox --sessions clean dist docs image notebook push status tag tests
**License**
© 2020 - 2021 Schneider Electric Industrie... | 1.96875 | 2 |
Others/[TCS CodeVita] - Perry the Platypus.py | yashbhatt99/HackerRank-Problems | 10 | 12777594 | # -*- coding: utf-8 -*-
"""
Created on Thu Mar 26 01:52:02 2020
@author: Ravi
"""
def PerryThisIsForYouMyFriend(arr,n):
index = []
prev = n*n-n+1
index.append(prev)
counter = 1
for i in range(n-1):
if counter < n//2+1 :
prev = prev - 2*n + 1
index.app... | 3.0625 | 3 |
src/bkl/interpreter/__init__.py | johnwbyrd/brakefile | 118 | 12777595 | #
# This file is part of Bakefile (http://bakefile.org)
#
# Copyright (C) 2008-2013 <NAME>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to
# deal in the Software without restriction, including without limita... | 1.757813 | 2 |
connections/rs232Connection.py | IKKUengine/EtaNetPythonClients | 2 | 12777596 | import time
import threading
import serial
import parameter
class Rs232Connection(threading.Thread):
exit = True
stop = True
try:
__ser = serial.Serial(
port='/dev/ttyS0', # Open RPI buit-in serial port
baudrate=9600,
parity=serial.PARITY_NONE,
... | 2.859375 | 3 |
setup.py | dcramer/jinja1-djangosupport | 2 | 12777597 | <filename>setup.py
# -*- coding: utf-8 -*-
"""
jinja
~~~~~
Jinja is a `sandboxed`_ template engine written in pure Python. It
provides a `Django`_ like non-XML syntax and compiles templates into
executable python code. It's basically a combination of Django templates
and python code.
Nutshell
--------
Here a small e... | 2.328125 | 2 |
examples/get_fact_simulations.py | mbrner/funfolding | 1 | 12777598 | <filename>examples/get_fact_simulations.py<gh_stars>1-10
import os
import requests
URL = 'http://www.blog.pythonlibrary.org/wp-content/uploads/2012/06/wxDbViewer.zip'
script_dir = os.path.dirname(os.path.abspath(__file__))
def download(url=URL):
path = os.path.join(script_dir, "fact_simulations.hdf")
r = r... | 2.828125 | 3 |
app/core/views.py | ariksidney/Webleaf | 5 | 12777599 | from flask import render_template, session, redirect, url_for
from flask_login import login_required
from . import core
@core.route('/', methods=['GET', 'POST'])
@login_required
def index():
return redirect(url_for('aurora.aurora_overview'))
@core.route('/offline.html')
def offline():
return core.send_stati... | 2.15625 | 2 |
16/16b.py | jamOne-/adventofcode2018 | 0 | 12777600 | <filename>16/16b.py
import re
import sys
OPERATIONS = {
'addr': lambda a, b, c, registers: registers[a] + registers[b],
'addi': lambda a, b, c, registers: registers[a] + b,
'mulr': lambda a, b, c, registers: registers[a] * registers[b],
'muli': lambda a, b, c, registers: registers[a] * b,
'banr': lambda a, ... | 3.3125 | 3 |
captcha_predict.py | junryan/pytorch-captcha-recognition | 0 | 12777601 | # -*- coding: UTF-8 -*-
import numpy as np
import pandas as pd
import torch
import time
from torch.autograd import Variable
import captcha_setting
import my_dataset
from captcha_cnn_model import CNN
def main():
print('开始对图片进行预测')
cnn = CNN()
cnn.eval()
cnn.load_state_dict(torch.load('model.pkl'))
... | 2.8125 | 3 |
example/issues/449_django_lazy_path/pulpsettings.py | sephiartlist/dynaconf | 2,293 | 12777602 | REST_FRAMEWORK__DEFAULT_AUTHENTICATION_CLASSES = (
"rest_framework.authentication.SessionAuthentication",
"pulpcore.app.authentication.PulpRemoteUserAuthentication",
"foo_bar1",
)
| 1.070313 | 1 |
dianhua/worker/crawler/china_mobile/heilongjiang/main.py | Svolcano/python_exercise | 6 | 12777603 | <gh_stars>1-10
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import base64
import json
import random
import re
import sys
import time
import traceback
import datetime
import hashlib
import urllib
from dateutil.parser import *
from dateutil.relativedelta import relativedelta
from pwd_change import des_... | 2.328125 | 2 |
job_server/src/job_server/app.py | jessicalucci/EB-Worker-RDS-VPC | 3 | 12777604 | import os
import yaml
import tornado.ioloop
import tornado.gen
import tornado.web
from job_server.context import JobServerContext
from job_server.routes import PostJobHandler, RunJobHandler
from job_server.db import init_db
def job_server(context):
return tornado.web.Application([
(r'/job/run', RunJobHan... | 2.171875 | 2 |
tests/test_util.py | mongodb-labs/mongo-web-shell | 22 | 12777605 | <gh_stars>10-100
# Copyright 2013 10gen Inc.
#
# 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... | 1.929688 | 2 |
products/tests/test_views.py | Kaique425/ecommerce | 0 | 12777606 | <filename>products/tests/test_views.py
from pytest_django.asserts import assertTemplateUsed, assertQuerysetEqual
from products.tests.factories import ProductFactory
from django.urls import resolve, reverse
from ..models import Product
import pytest
pytestmark = pytest.mark.django_db
@pytest.fixture
def list_respons... | 2.21875 | 2 |
python/ex039.py | deniseicorrea/Aulas-de-Python | 0 | 12777607 | <reponame>deniseicorrea/Aulas-de-Python<filename>python/ex039.py
from datetime import date
atual = date.today().year
nasc = int(input('Qual o ano do seu nascimento? '))
idade = atual- nasc
print(f'Voce tem {idade} anos')
if idade == 18:
print('Você tem que se alistar Imediatamente')
elif idade < 18:
saldo = 18 ... | 3.859375 | 4 |
moving_message_g009dh/examples/dict_test.py | Kurocon/moving_message_g009dh | 0 | 12777608 | <reponame>Kurocon/moving_message_g009dh<filename>moving_message_g009dh/examples/dict_test.py
from moving_message_g009dh.ledbar import *
if __name__ == "__main__":
bar = LEDBar()
bar.data_from_dict(data={
'files': [{
'number': 1,
'lines': [{
'fade': 'pacman',
... | 1.976563 | 2 |
configuration-client/configurator/thriftgen/ConfigurationService/__init__.py | manimaul/xio | 40 | 12777609 | __all__ = ['ttypes', 'constants', 'ConfigurationService']
| 1.070313 | 1 |
o365harvest.py | jmpalk/o365harvest | 3 | 12777610 | #!/usr/bin/env python3
import requests
import sys
import argparse
import uuid
from time import sleep
from string import Template
def Spray(domain, users, target_url, output_file, wait, verbose, more_verbose, debug):
i = 0
results = []
if verbose or more_verbose:
print("Targeting: " + target_url + "\n")
for... | 2.546875 | 3 |
Src/DockerMMODES/data_gen.py | beatrizgj/MDPbiomeGEM | 0 | 12777611 | #!/usr/bin/python3
# Script to shape the desired output to be processed (MMODES)
# the datatable way
# @author: <NAME>
# Creation: 09/06/2019
import os
import re
import numpy as np
import datatable as dt
from datatable import f
def log(cons, media):
'''
Writes information of consortium object to file
''... | 2.546875 | 3 |
secret_breakout/breakout.py | LaRiffle/private-RL | 4 | 12777612 | <filename>secret_breakout/breakout.py
from gym import logger
class Rect(object):
def __init__(self, left, top, width, height):
self.left = left
self.top = top
self.width = width
self.height = height
self.right = left + self.width
self.bottom = top + self.height
... | 3.59375 | 4 |
pydatamailbox/__init__.py | optimdata/pydatamailbox | 1 | 12777613 | <reponame>optimdata/pydatamailbox
from .client import * # NOQA
from .exceptions import * # NOQA
| 0.929688 | 1 |
products/migrations/0011_product_products_pr_name_9ff0a3_idx.py | MattiMatt8/ship-o-cereal | 1 | 12777614 | <reponame>MattiMatt8/ship-o-cereal<gh_stars>1-10
# Generated by Django 3.2 on 2021-05-10 16:55
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('products', '0010_alter_brand_options'),
]
operations = [
migrations.AddIndex(
mod... | 1.617188 | 2 |
tensorflow/python/autograph/pyct/static_analysis/type_inference.py | grasskin/tensorflow | 2 | 12777615 | # Copyright 2020 The TensorFlow Authors. 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://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | 1.945313 | 2 |
ERAutomation/steps/manager_login_steps.py | dboudreau4/ReimbursementSystemAutomation | 0 | 12777616 | <filename>ERAutomation/steps/manager_login_steps.py
from behave import given, when, then
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
@given('The Manager is on the Manager Login Page')
def open_manager_login(context):
context.driver.get("... | 2.53125 | 3 |
third_party/maya/lib/usdMaya/testenv/testUsdMayaAdaptorGeom.py | YuqiaoZhang/USD | 88 | 12777617 | #!/pxrpythonsubst
#
# Copyright 2018 Pixar
#
# Licensed under the Apache License, Version 2.0 (the "Apache License")
# with the following modification; you may not use this file except in
# compliance with the Apache License and the following modification to it:
# Section 6. Trademarks. is deleted and replaced with:
#
... | 2.015625 | 2 |
examples/QuantosDataService/runService.py | hzypage/TestPy | 18 | 12777618 | # encoding: UTF-8
"""
定时服务,可无人值守运行,实现每日自动下载更新历史行情数据到数据库中。
"""
import datetime as ddt
from dataService import *
if __name__ == '__main__':
taskCompletedDate = None
# 生成一个随机的任务下载时间,用于避免所有用户在同一时间访问数据服务器
taskTime = ddt.time(hour=17, minute=0)
# 进入主循环
while True:
t = ddt.datetime.n... | 2.453125 | 2 |
python/image_processing/closing.py | SayanGhoshBDA/code-backup | 16 | 12777619 | <filename>python/image_processing/closing.py
import cv2
import numpy as np
img = cv2.imread('closing.png',0)
kernel = np.ones((5,5),np.uint8)
closing = cv2.morphologyEx(img, cv2.MORPH_CLOSE, kernel)
blackhat = cv2.morphologyEx(img, cv2.MORPH_BLACKHAT, kernel)
gradient = cv2.morphologyEx(img, cv2.MORPH_GRADIENT, kerne... | 3.0625 | 3 |
seq_utils/construct_graph/construct_graph_v2.py | PTYin/ESRT | 0 | 12777620 | <filename>seq_utils/construct_graph/construct_graph_v2.py
import dgl
import pygraphviz as pyg
import torch
import pandas as pd
from argparse import ArgumentParser
import os
def construct_graph(df: pd.DataFrame):
users = df['userID'].unique()
items = df['asin'].unique()
item_map = dict(zip(items, range(len... | 2.609375 | 3 |
minpy/numpy/random.py | yuhonghong66/minpy | 1,271 | 12777621 | <reponame>yuhonghong66/minpy
#!/usr/bin/env python
# -*- coding: utf-8 -*-
""" Mock numpy random module """
#pylint: disable= invalid-name
from __future__ import absolute_import
import sys
from minpy.numpy.mocking import Module
_old = {
'__name__' : __name__,
}
sys.modules[__name__] = Module(_old, 'random')
| 1.945313 | 2 |
maxentropy/maxentutils.py | bluerobe25/maxentropy | 0 | 12777622 | """
Utility routines for the maximum entropy module.
Most of them are either Python replacements for the corresponding Fortran
routines or wrappers around matrices to allow the maxent module to
manipulate ndarrays, scipy sparse matrices, and PySparse matrices a
common interface.
Perhaps the logsumexp() function belon... | 2.71875 | 3 |
tests/persistence/test_persistence.py | daniel-thom/ditto | 44 | 12777623 | import six
if six.PY2:
from backports import tempfile
else:
import tempfile
import pytest as pt
import os
from ditto.readers.opendss.read import Reader as Reader_opendss
from ditto.readers.cyme.read import Reader as Reader_cyme
from ditto.writers.json.write import Writer
from ditto.store import Store
import lo... | 1.976563 | 2 |
2522.py | BACCHUS-S/Baekjoon | 0 | 12777624 | <filename>2522.py
i = int(input())
for j in range(1,i+1):
print(" "*(i-j) + "*"*j)
for k in range(1,i):
print(" "*k + "*"*(i-k))
| 3.25 | 3 |
Utils/process_valencic04.py | karllark/fuv_mir_rv_relationship | 0 | 12777625 | <filename>Utils/process_valencic04.py
import glob
# import numpy as np
from measure_extinction.extdata import ExtData
if __name__ == "__main__":
fpath = "data/valencic04/"
files = glob.glob(f"{fpath}*bin.fits")
for fname in files:
ifile = fname
ext = ExtData(ifile)
# get A(V) v... | 2.125 | 2 |
pyfitterbap/entry_points/crc.py | jetperch/fitterbap | 21 | 12777626 | <filename>pyfitterbap/entry_points/crc.py<gh_stars>10-100
# Copyright 2020-2021 Jetperch LLC
#
# 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... | 2.609375 | 3 |
pyatlas/unit_tests/test_identifier_converters.py | yazad3/atlas | 188 | 12777627 | import unittest
from pyatlas import identifier_converters
class IdentifierConvertersTest(unittest.TestCase):
def setUp(self):
pass
def test_osm_conversion(self):
atlas_id = 222222000000
osm_id = 222222
self.assertEqual(osm_id, identifier_converters.get_osm_identifier(atlas_id... | 2.71875 | 3 |
bkcore/strdistlib.py | accidental-bebop/BkStringMatch | 1 | 12777628 | """
String distance algorithm implementations
"""
# --- Imports
# --- String Distance Algorithms
def calculate_levenshtein_distance(string1, string2):
"""
Compute the minimum number of substitutions, deletions, and additions
needed to change string1 into string2.
Parameters
----------
string... | 3.921875 | 4 |
util_func/math_utils.py | ltoppyl/Zissen_team1_AGE | 1 | 12777629 | import numpy as np
def softmax(x, axis=None):
max = np.max(x,axis=axis,keepdims=True)
e_x = np.exp(x - max)
sum = np.sum(e_x,axis=axis,keepdims=True)
f_x = e_x / sum
return f_x | 3.015625 | 3 |
braillingo-demo/obr.py | code-coffee-ufcg/braillingo-backend | 1 | 12777630 | import cv2
import numpy as np
import statistics as stat
class optical_braille_recognition():
def __init__(self) -> None:
pass
def make_histogram_y(self, img):
'''
Organiza os dados da projeção horizontal na imagem
Entrada:
img -> Array da imagem
... | 3.390625 | 3 |
app/tasks/forms.py | 3dnygm4/titanium | 1 | 12777631 | <reponame>3dnygm4/titanium
#forms.py - help forms handing and data validation
#/app/tasks/forms.py
from wtforms import Form, TextField, DateField, IntegerField, \
SelectField, PasswordField, validators, RadioField
class AddTask(Form):
task_id = IntegerField('Pri... | 2.234375 | 2 |
open_fmri/apps/dataset/migrations/0018_auto_20151021_2215.py | rwblair/open_fmri | 5 | 12777632 | <reponame>rwblair/open_fmri
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
import django.core.validators
class Migration(migrations.Migration):
dependencies = [
('dataset', '0017_auto_20151020_2027'),
]
operations = [
migrations.... | 1.734375 | 2 |
bluetoothctl.py | ArcanoxDragon/SwitchProConProxy | 0 | 12777633 | import time
import pexpect
import re
import subprocess
from pexpect_strip_ansi import StripAnsiSpawn
class BluetoothctlError(Exception):
"""This exception is raised when bluetoothctl fails to start."""
pass
class Bluetoothctl:
"""A wrapper for bluetoothctl utility."""
def __init__(self, log=False):... | 2.875 | 3 |
webapp/__init__.py | PASTAplus/dex-deprecated | 0 | 12777634 | <filename>webapp/__init__.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
:Mod: __init__
:Synopsis:
Initialize webapp, including working directories (see Config.ROOT_DIR).
:Author:
servilla
:Created:
4/12/20
"""
import os
import daiquiri
from webapp.config import Config
logger = daiquiri.getLog... | 1.960938 | 2 |
clumioapi/models/ebs_restore_target_v1.py | clumio-code/clumio-python-sdk | 0 | 12777635 | <filename>clumioapi/models/ebs_restore_target_v1.py<gh_stars>0
#
# Copyright 2021. Clumio, Inc.
#
from typing import Any, Dict, Mapping, Optional, Sequence, Type, TypeVar
from clumioapi.models import aws_tag_common_model
T = TypeVar('T', bound='EBSRestoreTargetV1')
class EBSRestoreTargetV1:
"""Implementation o... | 2.125 | 2 |
planning/path_generator/astar.py | HybridRobotics/cbf | 9 | 12777636 | import heapq as hq
import math
import numpy as np
from models.geometry_utils import *
# TODO: Generalize to 3D?
class Node:
def __init__(self, pos, parent=None, g_cost=math.inf, f_cost=math.inf):
self.pos = pos
self.parent = parent
self.g_cost = g_cost
self.f_cost =... | 2.8125 | 3 |
main.py | Seokky/avito-flats-parser | 0 | 12777637 | <reponame>Seokky/avito-flats-parser
import requests
from bs4 import BeautifulSoup
from constants import BASE_URL, AD_ITEM_CLASS, RESULT_FNAME
from helpers import getAdContent, writeAdContentToFile
req = requests.get(BASE_URL)
soup = BeautifulSoup(req.text, features="lxml")
ads = soup.findAll('div', AD_ITEM_CLASS)
las... | 2.703125 | 3 |
examples/pyqtgraph_plot_block.py | Sout/pyrf | 0 | 12777638 | #!/usr/bin/env python
# import required libraries
from pyqtgraph.Qt import QtGui, QtCore
import pyqtgraph as pg
import sys
import numpy as np
from pyrf.devices.thinkrf import WSA
from pyrf.util import read_data_and_context
from pyrf.numpy_util import compute_fft
# plot constants
CENTER_FREQ = 2450 * 1e6
SAMPLE_SIZE... | 2.453125 | 2 |
tests/test_util.py | D-PLACE/pydplace | 1 | 12777639 | from pydplace.util import *
def test_remove_subdirs(tmpdir):
tmpdir.join('a').mkdir()
tmpdir.join('a', 'b').mkdir()
assert tmpdir.join('a', 'b').check()
remove_subdirs(str(tmpdir))
assert not tmpdir.join('a').check()
| 2.671875 | 3 |
setup.py | amehtaSF/QualtricsData | 0 | 12777640 | <gh_stars>0
import setuptools
import os
with open(f"{os.path.dirname(os.path.realpath(__file__))}/README.md", "r", encoding="utf-8") as fh:
long_description = fh.read()
setuptools.setup(
name="QualtricsData",
version="0.0.1",
author="<NAME>",
author_email="<EMAIL>",
description="A package to r... | 1.367188 | 1 |
jauth/repository/token_base.py | pjongy/jauth | 1 | 12777641 | <filename>jauth/repository/token_base.py<gh_stars>1-10
import abc
from jauth.model.token import Token
from jauth.repository import BaseRepository
class TokenRepository(BaseRepository, abc.ABC):
@abc.abstractmethod
async def find_token_by_id(self, _id: str) -> Token:
pass
@abc.abstractmethod
... | 2.265625 | 2 |
UnitTest/RPi_CameraTest/Camera+View.py | kullken/Pet-Mk-IV | 1 | 12777642 | import picamera
from time import sleep
import os
# Xlib: extension "RANDR" missing on display ":10.0".
#(gpicview:2869):
# GLib-GObject-WARNING **:
# Attempt to add property GtkSettings:
# :gtk-scrolled-window-placement after class was initialised
camera = picamera.PiCamera()
camera.rotation = 180
print ('klick1.py: ... | 2.765625 | 3 |
dev/scripts/process-starter.py | kohkimakimoto/hq | 62 | 12777643 | #!/usr/bin/env python
from __future__ import division, print_function, absolute_import, unicode_literals
import argparse, os, sys, re, fcntl, time, subprocess, textwrap, threading, signal
# utilities for compatibility.
PY2 = sys.version_info[0] == 2
PY3 = sys.version_info[0] == 3
if PY2:
input = raw_input
def... | 2.421875 | 2 |
tree.py | SIshikawa1106/planner | 0 | 12777644 | <gh_stars>0
import kdtree
from collections import deque
import numpy as np
DEBUG_VIEW = True
class Tree(object):
def __init__(self, node):
self.root = node
self.node_list = node[np.newaxis, :]
self._tree = kdtree.create([node], dimensions=node.size)
def get_root(self):
return ... | 2.859375 | 3 |
frappe/website/template.py | cadencewatches/frappe | 0 | 12777645 | <reponame>cadencewatches/frappe
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
from __future__ import unicode_literals
import frappe
from frappe.utils import strip_html
from frappe.website.utils import scrub_relative_urls
from jinja2.utils import concat
from jin... | 1.882813 | 2 |
gym_game_nim/envs/__init__.py | hfwittmann/gym_game_nim | 1 | 12777646 | <reponame>hfwittmann/gym_game_nim<filename>gym_game_nim/envs/__init__.py
from gym_game_nim.envs.game_nim_env import GameNimEnv
| 1.203125 | 1 |
data/test_drawing_box.py | vuanh96/Thesis | 0 | 12777647 | import cv2
import os
import sys
if sys.version_info[0] == 2:
import xml.etree.cElementTree as ET
else:
import xml.etree.ElementTree as ET
if __name__ == "__main__":
for line in open("MOT17/train/ImageSets/Main/trainval.txt", "r"):
line = line.rstrip()
img_path = os.path.join("M... | 2.625 | 3 |
MAIN/LOGIC/board.py | SI-Jeson-Mor-NineHorses/NineHorses | 0 | 12777648 | from MAIN.LOGIC.pieces import *
class Board:
# Plansza reprezentowana za pomocą tablicy 9x9. 'None' oznacza pusty kwadrat.
def __init__(self):
self.recently_highlighted = []
self.empty = [[None for x in range(9)] for y in range(9)]
self.array = [
[Knight("b", 0, i) for i in... | 3.15625 | 3 |
src/spaceone/inventory/model/region_model.py | whdalsrnt/inventory | 9 | 12777649 | <gh_stars>1-10
from mongoengine import *
from spaceone.core.model.mongo_model import MongoModel
class RegionTag(EmbeddedDocument):
key = StringField(max_length=255)
value = StringField(max_length=255)
class Region(MongoModel):
region_id = StringField(max_length=40, generate_id='region', unique=True)
... | 2.25 | 2 |
src/passpredict/satellites/__init__.py | samtx/pass-predictor | 0 | 12777650 | from .base import LLH
from .sgp4 import SGP4Propagator
from .kepler import KeplerPropagator
__all__ = [
'LLH',
'SGP4Propagator',
'KeplerPropagator',
]
| 1.007813 | 1 |