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 |
|---|---|---|---|---|---|---|
openstates/openstates-master/openstates/ca/actions.py | Jgorsick/Advocacy_Angular | 0 | 37900 | from billy.scrape.actions import Rule, BaseCategorizer
# These are regex patterns that map to action categories.
_categorizer_rules = (
Rule((r'\(Ayes (?P<yes_votes>\d+)\.\s+Noes\s+'
r'(?P<no_votes>\d+)\.( Page \S+\.)?\)')),
Rule(r'^Introduced', 'bill:introduced'),
Rule(r'(?i)Referred to (?P<... | 2.5625 | 3 |
tests/unit_tests/test_managers/test_resource.py | radical-project/radical.dreamer | 4 | 37901 | <filename>tests/unit_tests/test_managers/test_resource.py
# pylint: disable=unused-argument
__copyright__ = 'Copyright 2021, The RADICAL-Cybertools Team'
__license__ = 'MIT'
import pika.exceptions
from radical.dreamer.configs import cfg_default
from radical.dreamer.managers import ResourceManager
from radical.drea... | 2.109375 | 2 |
aniconforanilist.py | EnArvy/anicon | 5 | 37902 | <reponame>EnArvy/anicon
from warnings import filterwarnings
from PIL import Image, ImageOps
import requests
from requests import get
import re
import os
import json
print('''Run this in your anime folder
For help and info, check out
https://github.com/EnArvy/anicon
''')
filterwarnings("ignore")
folder... | 2.953125 | 3 |
C_util/functions.py | catnlp/MultiNER | 0 | 37903 | <gh_stars>0
# encoding:utf-8
'''
@Author: catnlp
@Email: <EMAIL>
@Time: 2018/5/2 21:04
'''
import numpy as np
def normalize_word(word):
new_word = ''
for char in word:
if char.isdigit():
new_word += '0'
else:
new_word += char
return new_word
def read_instance(input_... | 3 | 3 |
ziggurat_foundations/tests/test_permissions.py | ergo/ziggurat_foundations | 59 | 37904 | # -*- coding: utf-8 -*-
from __future__ import with_statement, unicode_literals
import pytest
from ziggurat_foundations.models.services.group_permission import GroupPermissionService
from ziggurat_foundations.models.services.group_resource_permission import (
GroupResourcePermissionService,
)
from ziggurat_founda... | 1.976563 | 2 |
waveshare_eink/server/start.py | dhvie/waveshare-eink | 0 | 37905 | from flask import Flask
from flask import render_template
import datetime as dt
import json
import jinja2 as j2
import requests
import argparse
import os
import feedparser
from pathlib import Path
class OpenWeatherAPI():
url = j2.Template('https://api.openweathermap.org/data/2.5/onecall?lat={{lat}}&lon={{lon}}&ap... | 2.703125 | 3 |
basic_ml/notebooks/numpy/performance_test.py | jmetzz/ml-laboratory | 1 | 37906 | <gh_stars>1-10
import numpy as np
# Create an array with 10^7 elements
arr = np.arange(1e7)
# Converting ndarray to list
larr = arr.tolist()
def list_times(alist, scalar):
return [val * scalar for val in alist]
# Using IPython's magic
# timeit command timeit arr * 1.1
# timeit list_times(larr, 1.1)
# box(x... | 3 | 3 |
tests/file_formats/variables/egf_vars.py | HFM3/strix | 0 | 37907 | """
EGF string variables for testing.
"""
# POINT
valid_pt = """PT
Park Name, City, Pond, Fountain
Post office Square, Boston, FALSE, TRUE
42.356243, -71.055631, 2.0
Boston Common, Boston, TRUE, TRUE
42.355465, -71.066412, 10.0
"""
invalid_pt_geom = """PTs
Park Name, City, Pond, Fountain
Post office S... | 1.671875 | 2 |
app/__init__.py | jesiqueira/work | 0 | 37908 | from flask import Flask
def create_app():
app = Flask(__name__)
#Rotas
from app.controllers.main.rotas import main
#Registrar Blueprint
app.register_blueprint(main)
return app
| 1.914063 | 2 |
risk_register/rules.py | justin441/risk_management | 0 | 37909 | import rules
# ------------predicates------------
# Processus
@rules.predicate
def is_process_manager(user, processus):
return processus.proc_manager == user
@rules.predicate
def is_process_upper_mgt(user, processus):
bu = processus.business_unit
return bu.bu_manager == user
# Activités
@rules.predic... | 2.375 | 2 |
tests/integration/test_ims.py | acidjunk/python-zeep | 0 | 37910 | import os
import uuid
import requests_mock
import zeep
def read_file(file_name, folder="wsdl_ims"):
file = os.path.join(os.path.dirname(os.path.realpath(__file__)), folder, file_name)
with open(file) as f:
return f.read()
def test_find_customer():
with requests_mock.mock() as m:
m.get(... | 2.390625 | 2 |
EMPIRIC_POSTPROCESS/SPalignResults/run_pdb.py | yvehchan/TIM_EMPIRIC | 0 | 37911 | import subprocess as sub
import sys
# tm_pdb = ('Tm',"pdb1i4n_A.ent")
# tt_pdb = ('Tt',"pdb1vc4_A.ent")
# ss_pdb = ('Ss',"pdb2c3z_A.ent")
if sys.argv[1] == 'Tm':
template_name, current_template = 'Tm',"pdb1i4n_A.ent"
elif sys.argv[1] == 'Tt':
template_name, current_template = 'Tt',"pdb1vc4_A.ent"
elif sys.a... | 2.25 | 2 |
search/migrations/0006_auto_20180516_0457.py | kimyou7/ParkGoGreen | 0 | 37912 | <gh_stars>0
# Generated by Django 2.0.2 on 2018-05-16 11:57
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('search', '0005_auto_20180516_0455'),
]
operations = [
migrations.AlterField(
model_name='park',
name='zi... | 1.40625 | 1 |
tests/conftest.py | davidkyburz/gtfs-lite | 4 | 37913 | <filename>tests/conftest.py
from datetime import date, time
import pytest
@pytest.fixture
def feed_zipfile():
return r"data/metra_2020-02-23.zip"
@pytest.fixture
def test_date():
return date(2020, 2, 24)
@pytest.fixture
def test_timerange():
return [time(0, 0), time(23, 59)]
@pytest.fixture
def test_sto... | 1.804688 | 2 |
dotplug/__init__.py | arubertoson/dotplug | 0 | 37914 | """
Entry Point
"""
import asyncio
from dotplug.main import main
from dotplug.console import ncurses
def _main():
import uvloop
asyncio.set_event_loop_policy(uvloop.EventLoopPolicy())
with ncurses():
asyncio.run(main())
input("")
| 1.804688 | 2 |
signalr_async/core/messages.py | sam-mosleh/signalr-async | 4 | 37915 | <gh_stars>1-10
from dataclasses import dataclass, field
from enum import IntEnum
from typing import Any, Dict, List, Optional, Union
class MessageTypes(IntEnum):
INVOCATION = 1
STREAM_ITEM = 2
COMPLETION = 3
STREAM_INVOCATION = 4
CANCEL_INVOCATION = 5
PING = 6
CLOSE = 7
class HubMessageB... | 2.234375 | 2 |
setuper web app/handlers/admin/adminhandler.py | dragondjf/CloudSetuper | 22 | 37916 | <gh_stars>10-100
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from tornado.web import authenticated, removeslash
from handlers.basehandlers import BaseHandler
adminusers = [
{
'username': 'admin',
'password': '<PASSWORD>'
}
]
class AdminLoginHandler(BaseHandler):
role = "admin"
@... | 2.453125 | 2 |
testbyxcj/datasender.py | AlsikeE/Ez | 0 | 37917 | #coding:utf-8
from mininet.net import Mininet
from mininet.topo import LinearTopo
from mininet.cli import CLI
# from eventlet import greenthread
import argparse
import threading
import re
from time import sleep
import logging
logger = logging.getLogger(__name__)
logger.setLevel(level = logging.INFO)
handler = loggin... | 2.0625 | 2 |
pullcord-export.py | tsudoko/pullcord-export | 0 | 37918 | #!/usr/bin/env python3
import collections
import datetime
import glob
import html
import re
import sys
# this is a mess right now, feel free to make it less bad if you feel like it
try:
# python 3.7+
datetime.datetime.fromisoformat
except AttributeError:
# not fully correct, but good enough for this use case
adjt... | 2.265625 | 2 |
sem/gui/misc.py | YoannDupont/SEM | 22 | 37919 | <filename>sem/gui/misc.py
"""
file: misc.py
author: <NAME>
MIT License
Copyright (c) 2018 <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 limitatio... | 2.625 | 3 |
character-identifier/embedding_loader.py | vtt-project/vtt-char-identify | 12 | 37920 | <reponame>vtt-project/vtt-char-identify
import os
import sys
import numpy as np
import gensim
from gensim.models import word2vec
import data_utils
from config_utils import data_paths
DECREASE_FACTOR=1e-4 # TODO @Future: there should be a smarter way
def load_word2vec_embeddings(filename):
binary_file = ".bin" ... | 2.78125 | 3 |
goNord.py | MiraculousMoon/ImageGoNord-pip | 0 | 37921 | <gh_stars>0
#!/usr/bin/env python3
from ImageGoNord import NordPaletteFile, GoNord
import sys, os
def main():
dirOld = "/home/mir/Pictures/wallhaven/"
dirNew = "/home/mir/Pictures/newWall/"
for root, dirs, files in os.walk(dirOld):
for file in files:
imagePath = dirOld + file
... | 2.40625 | 2 |
graphic_convergence_topology.py | win7/parallel_social_spider_optimization | 1 | 37922 | # -*- coding: utf-8 -*-
"""
============================================================================
Authors:
<NAME> and <NAME>*
*Department of Informatics
Universidad Nacional de San Antonio Abad del Cusco (UNSAAC) - Perú
============================================================================
"""
# Python... | 2.53125 | 3 |
TestInterfaceResiduePrediction.py | sebastiandaberdaku/AntibodyInterfacePrediction | 10 | 37923 | # This script runs the IF algorithm for outlier detection to remove false positive patches and maps the predicted LSPs on the underlying residues.
# The results are compared to other predictor software packages.
# Please remember to set the path variable to the current location of the test set.
import numpy as np
from... | 2.328125 | 2 |
solrcl/document.py | zaccheob/solrcl | 0 | 37924 | <gh_stars>0
# -*- coding: utf8 -*-
import warnings
import xml.etree.cElementTree as ET
import re
import logging
logger = logging.getLogger("solrcl")
logger.setLevel(logging.DEBUG)
import exceptions
class SOLRDocumentError(exceptions.SOLRError): pass
class SOLRDocumentWarning(UserWarning): pass
class SOLRDocument(ob... | 2.515625 | 3 |
testscripts/RDKB/component/WIFIAgent/TS_WIFIAGENT_CheckTelemetryMarkerCHUTIL_2_Logging.py | rdkcmf/rdkb-tools-tdkb | 0 | 37925 | <filename>testscripts/RDKB/component/WIFIAgent/TS_WIFIAGENT_CheckTelemetryMarkerCHUTIL_2_Logging.py
##########################################################################
# If not stated otherwise in this file or this component's Licenses.txt
# file the following copyright and licenses apply:
#
# Copyright 2021 RDK... | 1.796875 | 2 |
stubs.min/System/Runtime/InteropServices/__init___parts/GuidAttribute.py | denfromufa/ironpython-stubs | 1 | 37926 | class GuidAttribute(Attribute,_Attribute):
"""
Supplies an explicit System.Guid when an automatic GUID is undesirable.
GuidAttribute(guid: str)
"""
def __init__(self,*args):
""" x.__init__(...) initializes x; see x.__class__.__doc__ for signaturex.__init__(...) initializes x; see x.__class__.__doc__ f... | 2.671875 | 3 |
fern/models.py | edilio/dental | 1 | 37927 | <reponame>edilio/dental<gh_stars>1-10
import datetime
from django.db import models
from django.utils import timezone
class Source(models.Model):
name = models.CharField(max_length=50)
def __unicode__(self):
return self.name
GENDER_CHOICES = (
('F', 'Female'),
('M', 'Male'),
)
class Patie... | 2.25 | 2 |
plot-salience-parsing-results.py | zetnim/saliency-semantic-parsing-reid | 12 | 37928 | import os.path as osp
import os
import pylab as plt
import gc
import argparse
from utils import read_image
parser = argparse.ArgumentParser(description='Plot rank-5 results of S-ReID, SP-ReID and SSP-ReID')
parser.add_argument('-d', '--dataset', type=str, default='market1501')
# Architecture
parser.add_argument('-a... | 2.3125 | 2 |
quoters/check_connection.py | suman-kr/random-quotes | 22 | 37929 | <reponame>suman-kr/random-quotes<filename>quoters/check_connection.py
import socket
from quoters.constants import CONN_URL
def is_connected():
try:
sock_conn = socket.create_connection((CONN_URL, 80))
if(sock_conn):
sock_conn.close()
return True
except OSError:
pass
... | 2.34375 | 2 |
tests.py | mkolar/maya-capture | 118 | 37930 | <filename>tests.py
"""Tests for capture.
Within Maya, setup a scene of moderate range (e.g. 10 frames)
and run the following.
Example:
>>> nose.run(argv=[sys.argv[0], "tests", "-v"])
"""
import capture
from maya import cmds
def test_capture():
"""Plain capture works"""
capture.capture()
def test_cam... | 2.546875 | 3 |
examples/ubqc/client.py | cgmcintyr/SimulaQron | 0 | 37931 | import random
import struct
import sys
import time
from pathlib import Path
import numpy as np
from SimulaQron.general.hostConfig import *
from SimulaQron.cqc.backend.cqcHeader import *
from SimulaQron.cqc.pythonLib.cqc import *
from flow import circuit_file_to_flow, count_qubits_in_sequence
from angle import measure... | 2.71875 | 3 |
save_combine.py | firebrettbrown/bbgm | 11 | 37932 | <reponame>firebrettbrown/bbgm
import argparse
import os
import sys
import shutil
import subprocess
import re
from bs4 import BeautifulSoup
import pandas as pd
import numpy as np
import pickle
from selenium import webdriver
tables = {}
parser = argparse.ArgumentParser(formatter_class=argparse.ArgumentDefaultsHelpFor... | 2.515625 | 3 |
osgar/test_node.py | m3d/osgar_archive_2020 | 12 | 37933 | import unittest
from unittest.mock import MagicMock
from datetime import timedelta
from osgar.bus import Bus
from osgar.node import Node
class NodeTest(unittest.TestCase):
def test_usage(self):
empty_config = {}
bus = Bus(logger=MagicMock())
node = Node(config=empty_config, bus=bus.handl... | 2.46875 | 2 |
Programacao I/main.py | HiggsWRX/uevora | 1 | 37934 | '''Disciplina: Programação I
Trabalho prático ano lectivo 2013/2014
Realizado por <NAME> (29248) e <NAME> (31511)
'''
class Village:
# Constructor method
# Used to create a new instance of Village, taking in arguments like
# its size and population, then builds the board used throughout the
# program
... | 3.859375 | 4 |
backend/src/services/post_translation/post_translation.py | didi/MeetDot | 6 | 37935 | <reponame>didi/MeetDot
"""
The main responsibilites of PostTranslation class are:
1) initialize given strategy
2) take API request
3) remove profanity
4) return translation text after these processes
Post-translation API input:
{
"session_id": unique session ID,
"strategies": list of strategies want to be app... | 2.578125 | 3 |
src/3-2-7.py | Nikxxx007/sturyPython | 0 | 37936 | from math import *
def main():
rad = int(input('rad = '))
for i in range(10):
numb = i + 1
print(f'Shot number: {numb}')
x = float(input('x = '))
y = float(input('y = '))
if pow((x + sqrt(rad)), 2) + pow((y - sqrt(rad)), 2) > rad and x < 0 and y > 0:
print('yes')
elif 2*rad > x > 0 ... | 3.546875 | 4 |
navigationCommand.py | islam-shamiul/Selenium_python | 0 | 37937 | from selenium import webdriver
from selenium.webdriver.common.keys import Keys
import time
driver = webdriver.Chrome(executable_path="E:/SQA/chromedriver_win32/chromedriver.exe")
driver.get("http://newtours.demoaut.com/")
time.sleep(5)
print(driver.title)
driver.get("https://www.google.com/")
time.sleep(5)
print(dr... | 2.796875 | 3 |
modules/coins/network.py | blakebjorn/tuxpay | 0 | 37938 | import asyncio
import datetime
import json
import warnings
from pathlib import Path
from typing import Tuple, Optional, TYPE_CHECKING
import aiorpcx
from modules import config
from modules.electrum_mods.functions import BIP32Node, pubkey_to_address, address_to_script, \
script_to_scripthash, constants
from module... | 1.859375 | 2 |
tests/acquisition/covidcast/test_direction_updater.py | sgsmob/delphi-epidata | 0 | 37939 | """Unit tests for direction_updater.py."""
# standard library
import argparse
import unittest
from unittest.mock import MagicMock
# py3tester coverage target
__test_target__ = 'delphi.epidata.acquisition.covidcast.direction_updater'
class UnitTests(unittest.TestCase):
"""Basic unit tests."""
def test_get_argum... | 3.0625 | 3 |
main.py | stspbu/repository-downloader | 3 | 37940 | import requests
import os
import logging
import subprocess
import re
import settings
_GITHUB_BASE_URL = 'https://api.github.com'
_REPO_DIR = settings.get('repo_dir', os.getcwd())
_REPO_CNT = settings.get('repo_count', 10)
_QUERY_STRING = settings.get('repo_query_string')
_TOKEN = settings.get('github_token', require... | 2.5625 | 3 |
p2p_python/tool/share.py | yoosofan/p2p-python | 0 | 37941 | #!/user/env python3
# -*- coding: utf-8 -*-
import threading
import time
import os.path
from hashlib import sha256
import bjson
import logging
import random
from binascii import hexlify
from ..config import C, V, PeerToPeerError
from ..client import FileReceiveError, ClientCmd
from .utils import AESCipher
class File... | 2.265625 | 2 |
sbinn/sbinn_tf.py | lu-group/sbinn | 5 | 37942 | import numpy as np
import deepxde as dde
from deepxde.backend import tf
import variable_to_parameter_transform
def sbinn(data_t, data_y, meal_t, meal_q):
def get_variable(v, var):
low, up = v * 0.2, v * 1.8
l = (up - low) / 2
v1 = l * tf.tanh(var) + l + low
return v1
... | 2.359375 | 2 |
services/web/server/src/simcore_service_webserver/session.py | oetiker/osparc-simcore | 0 | 37943 | """ Session submodule
"""
from aiohttp import web
from servicelib.session import get_session
from servicelib.session import setup_session as do_setup_session
def setup(app: web.Application):
do_setup_session(app)
# alias
setup_session = setup
__all__ = (
"setup_session",
"get_session",
)
| 1.789063 | 2 |
photometa/forms.py | Flantropy/photometalizer | 0 | 37944 | from django.core.exceptions import ValidationError
from django.core.validators import FileExtensionValidator
from django.core.files.uploadedfile import InMemoryUploadedFile
from django.forms import Form, ModelForm, FileInput
from django.forms.fields import *
from captcha.fields import CaptchaField
from .models import ... | 2.296875 | 2 |
setup.py | liu-bin-fluid/PySPOD | 0 | 37945 | import os
import sys
import pyspod
import shutil
from setuptools import setup
from setuptools import Command
# GLOBAL VARIABLES
NAME = pyspod.__name__
URL = pyspod.__url__
AUTHOR = pyspod.__author__
EMAIL = pyspod.__email__
VERSION = pyspod.__version__
KEYWORDS='spectral-proper-orthogonal-decomposition spod'
REQUIRED ... | 2.09375 | 2 |
scripts/make_s2and_mini_dataset.py | atypon/S2AND | 39 | 37946 | import os
import json
import pickle
import collections
import numpy as np
from s2and.consts import CONFIG
DATA_DIR = CONFIG["main_data_dir"]
OUTPUT_DIR = os.path.join(DATA_DIR, "s2and_mini")
if not os.path.exists(OUTPUT_DIR):
os.mkdir(OUTPUT_DIR)
# excluding MEDLINE because it has no clusters
DATASETS = [
"a... | 2.328125 | 2 |
adminmgr/media/code/python/red3/R1.py | IamMayankThakur/test-bigdata | 9 | 37947 | <gh_stars>1-10
#!/usr/bin/python3
"""reducer.py"""
from operator import itemgetter
import sys
answer_dict={}
current_batsman = None
current_count = 0
current_out=0
word = None
max_wicket=0
# input comes from STDIN
for line in sys.stdin:
line = line.strip()
batsman,wtype,count = line.split('\t')
try:
count = int(c... | 2.765625 | 3 |
20160821_wavetable_chorus/code/runscripts/run_sawtooth.py | weegreenblobbie/sd_audio_hackers | 1 | 37948 |
import matplotlib.pyplot as plt
from sdaudio.callables import Circular
from sdaudio.callables import Constant
from sdaudio import draw
from sdaudio import wavio
from sdaudio.wt_oscillators import Choruses
def main():
#-------------------------------------------------------------------------
# sawtooth dem... | 2.828125 | 3 |
geotrek/outdoor/migrations/0026_auto_20210915_1346.py | GeotrekCE/Geotrek | 50 | 37949 | <reponame>GeotrekCE/Geotrek
# Generated by Django 3.1.13 on 2021-09-15 13:46
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('outdoor', '0025_merge_ratings_min_max'),
]
operations = [
migrations.RemoveField(
model_name='site'... | 1.578125 | 2 |
run.py | nicholasfalconi/Restaurant-modeling-project | 0 | 37950 | """
<NAME>
<NAME>
<NAME>
<NAME>
CISC 204
Modelling project
Wed december 9th 2020
Professor Muise
"""
#Import
from nnf import Var
from nnf import Or
import nnf
from lib204 import Encoding
from csvReader import readCSV
'''
Customer class
Used to create a class containing the various restrictions a
person might have ... | 3.828125 | 4 |
tdd/app/t_stock_backtest.py | yt7589/aqp | 0 | 37951 | <filename>tdd/app/t_stock_backtest.py
import unittest
from app.stock_backtest import StockBacktest
class TStockBacktest(unittest.TestCase):
def test_buy_stock(self):
user_id = 1
account_id = 1
ts_code = '603912.SH'
curr_date = '20190102'
buy_vol = 888
sbt = StockBack... | 2.953125 | 3 |
lib/sii_connector_auth.py | SunPaz/sii-dte-py | 0 | 37952 | <reponame>SunPaz/sii-dte-py
from lib.sii_connector_base import SiiConnectorBase
from lxml.etree import tostring
import logging
from requests import Session
from zeep import Client,Transport
from lib.zeep.sii_plugin import SiiPlugin
from zeep.exceptions import SignatureVerificationFailed
import re
class SiiConnectorAut... | 2.234375 | 2 |
src/psd_tools/decoder/image_resources.py | jacenfox/psd-tools2 | 2 | 37953 | <reponame>jacenfox/psd-tools2
# -*- coding: utf-8 -*-
from __future__ import absolute_import, unicode_literals, division
import io
import warnings
from collections import namedtuple
from psd_tools.utils import (read_pascal_string, unpack, read_fmt,
read_unicode_string, be_array_from_bytes,
... | 1.453125 | 1 |
Python/Arquivos/conta_palavras.py | lucsap/APC | 0 | 37954 | <reponame>lucsap/APC
def palavras_repetidas(fileName, word):
file = open(fileName, 'r')
count = 0
for i in file.readlines():
if word in i:
count += 1
print(f'{word} aparece no arquivo {fileName} {count} vez(es).') | 3.40625 | 3 |
Full_Version.py | Hermosa-Ren/Histogram_of_Oriented_Gradients | 0 | 37955 | import os
import cv2
import numpy as np
import matplotlib.pyplot as plt
def Compute_Block(cell_gradient_box):
k=0
hog_vector = np.zeros((bin_size*4*(cell_gradient_box.shape[0] - 1)*(cell_gradient_box.shape[1] - 1)))
for i in range(cell_gradient_box.shape[0] - 1):
for j in range(cell_gradient... | 2.78125 | 3 |
CodeForces/Bit++.py | PratikGarai/Coding-Challenges | 0 | 37956 | n = int(input())
x = 0
for i in range(n):
l = set([j for j in input()])
if "+" in l:
x += 1
else :
x -= 1
print(x)
| 3.03125 | 3 |
boj/dynamic/boj_2193.py | ruslanlvivsky/python-algorithm | 3 | 37957 | import sys
n = int(sys.stdin.readline().strip())
dp = [[0, 0] for _ in range(n + 1)]
dp[1][1] = 1
for i in range(2, n + 1):
dp[i][0] = dp[i - 1][0] + dp[i - 1][1]
dp[i][1] = dp[i - 1][0]
result = dp[n][0] + dp[n][1]
sys.stdout.write(str(result))
| 2.59375 | 3 |
geotrek/feedback/urls.py | GeotrekCE/Geotrek | 0 | 37958 | from django.conf import settings
from django.urls import path, register_converter
from mapentity.registry import registry
from rest_framework.routers import DefaultRouter
from geotrek.common.urls import LangConverter
from geotrek.feedback import models as feedback_models
from .views import CategoryList, FeedbackOptio... | 1.742188 | 2 |
tests/unit/utils/test_views.py | rolandgeider/OpenSlides | 0 | 37959 | from unittest import TestCase
from unittest.mock import MagicMock, patch
from openslides.utils import views
@patch('builtins.super')
class SingleObjectMixinTest(TestCase):
def test_get_object_cache(self, mock_super):
"""
Test that the method get_object caches his result.
Tests that get_o... | 2.53125 | 3 |
librair/parsers.py | herreio/librair | 1 | 37960 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
from .schemas import plain
from .protocols import http
class Beacon:
"""
Beacon parser for files exposed by given path or url
"""
def __init__(self, path="", url=""):
self.path = path
self.url = url
self.raw = []
self.met... | 3.078125 | 3 |
flask_wdb.py | techniq/flask-wdb | 7 | 37961 | from flask import Flask
from wdb.ext import WdbMiddleware
class Wdb(object):
def __init__(self, app=None):
self.app = app
if app:
self.init_app(self.app)
def init_app(self, app):
if app.config.get('WDB_ENABLED', app.debug):
start_disabled = app.config.get('WD... | 2.28125 | 2 |
uib_experiments/experiment/experiment.py | miquelmn/uib_experiments | 0 | 37962 | <reponame>miquelmn/uib_experiments
# -*- coding: utf-8 -*-
""" Experiment module.
This module contains a set of function and classes to handles experiments. The aim of these methods
is to be able to save results easily with an standard format.
Written by: <NAME>
"""
from typing import Union, Tuple, List
import os
imp... | 3 | 3 |
Leetcode/0498. Diagonal Traverse.py | luckyrabbit85/Python | 1 | 37963 | <reponame>luckyrabbit85/Python
import collections
class Solution:
def findDiagonalOrder(self, matrix: list[list[int]]) -> list[int]:
hashmap = collections.defaultdict(list)
for i in range(len(matrix)):
for j in range(len(matrix[i])):
hashmap[i + j].append(matrix[i][j])
... | 3.21875 | 3 |
src/mars_profiling/__init__.py | wjsi/mars-profiling | 1 | 37964 | <filename>src/mars_profiling/__init__.py
"""Main module of pandas-profiling.
.. include:: ../../README.md
"""
from mars_profiling.config import Config, config
from mars_profiling.controller import pandas_decorator
from mars_profiling.profile_report import ProfileReport
from mars_profiling.version import __version__
... | 1.296875 | 1 |
revscoring/revscoring/languages/features/dictionary/tests/test_util.py | yafeunteun/wikipedia-spam-classifier | 2 | 37965 | <gh_stars>1-10
from nose.tools import eq_
from ..util import utf16_cleanup
def test_utf16_cleanup():
eq_(utf16_cleanup("Foobar" + chr(2 ** 16)),
"Foobar\uFFFD")
| 2.015625 | 2 |
whereToGo/src/sensors/_conf_sensors.py | k323r/whereToGo | 0 | 37966 | <gh_stars>0
import os.path
ROOT = os.path.dirname(
os.path.dirname(
os.path.dirname(
os.path.abspath(__file__)
)))
| 1.59375 | 2 |
tools/fileinfo/features/eziriz-packer-detection/test.py | stepanek-m/retdec-regression-tests | 0 | 37967 | <reponame>stepanek-m/retdec-regression-tests<gh_stars>0
from regression_tests import *
class Eziriz42Test(Test):
settings = TestSettings(
tool='fileinfo',
args='--json --verbose',
input=['x86-pe-ff10e014c94cbc89f9e653bc647b6d5a', 'x86-pe-d5a674ff381b95f36f3f4ef3e5a8d0c4-eziriz42']
)
... | 2.21875 | 2 |
Codigo_EngDados/exe03.py | SouzaMarcel0/Exercicios_Python | 0 | 37968 | <reponame>SouzaMarcel0/Exercicios_Python<gh_stars>0
client = pymongo.MongoClient("mongodb+srv://usermgs:udUnpg6aJnCp9d2W@<EMAIL>.mongodb.net/baseteste?retryWrites=true&w=majority")
db = client.test
| 1.460938 | 1 |
clean_crime_file.py | sachinmyneni/fundata | 0 | 37969 | <reponame>sachinmyneni/fundata
import pandas as pd
import re
import logging
def badrow(address: str, city: str) -> bool:
return city.split('_')[0].lower() not in address.lower()
# logging.basicConfig(filename="spotcrime_scrape.log", level=logging.DEBUG,
# filemode='a', format='%(asctime)s %(me... | 2.921875 | 3 |
flash/data/data_module.py | edgarriba/lightning-flash | 1 | 37970 | <filename>flash/data/data_module.py
# Copyright The PyTorch Lightning team.
#
# 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 requi... | 2.28125 | 2 |
image_generation/data/testing.py | BScarleth/clevr-dataset-generation-mask | 0 | 37971 | import cv2
#image = cv2.imread('/home/brenda/Documentos/independent_study/clevr-dataset-gen/output/images/CLEVR_new_000000.png')
#image = cv2.imread('/home/brenda/Escritorio/tmpps5tswcu.png')
image = cv2.imread('/home/brenda/Escritorio/tmp47s462az.png')
print("imagen: ", image.shape, " ", image.shape[0]* image.sha... | 3.25 | 3 |
C1.py | dpocheng/SIMPLESEM-Compiler-Semantic | 0 | 37972 | <filename>C1.py
a, b, c = 3, 1, -1
def main():
global a, b
while a > c:
if a == 0:
print b
else:
b = b + a
a = a - 1
print a
print b
print c
main()
| 3.609375 | 4 |
accounts/accounts/doctype/purchase_invoice/purchase_invoice.py | sumaiya2908/Accounting-App | 0 | 37973 | # Copyright (c) 2021, Summayya and contributors
# For license information, please see license.txt
# import frappe
from frappe.model.document import Document
from ..gl_entry.gl_entry import create_gl_entry
class PurchaseInvoice(Document):
def validate(self):
self.set_status()
self.set_total_amoun... | 2.0625 | 2 |
setup.py | dgaston/kvasir | 0 | 37974 | <gh_stars>0
from setuptools import setup
setup(name='Kvasir',
version='0.9',
description='Kvasir OpenShift App',
author='<NAME>',
author_email='<EMAIL>',
url='https://www.python.org/community/sigs/current/distutils-sig',
install_requires=['Flask', 'MarkupSafe', 'Flask-MongoEngine', ... | 1.117188 | 1 |
stoich.py | jonasoh/thermosampler | 2 | 37975 | <reponame>jonasoh/thermosampler
#!/usr/bin/env python3
# Import modules
import sys, os
import pandas as pd
import collections
import itertools
import argparse
import re
# Import functions
from mdf import parse_equation, read_reactions
# Define functions
def sWrite(string):
sys.stdout.write(string)
sys.stdout... | 2.765625 | 3 |
engine/vector.py | dbrizov/PyTetris | 3 | 37976 | <reponame>dbrizov/PyTetris
import math
class Vector2(tuple):
def __new__(cls, x, y):
return tuple.__new__(cls, (x, y))
@property
def x(self):
return self[0]
@property
def y(self):
return self[1]
def __add__(self, vector):
return Vector2(self.x + vector.x, sel... | 3.359375 | 3 |
cytomine-applications/landmark_model_builder/validation.py | Cytomine-ULiege/Cytomine-python-datamining | 0 | 37977 | # -*- coding: utf-8 -*-
#
# * Copyright (c) 2009-2015. Authors: see NOTICE file.
# *
# * 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... | 2.265625 | 2 |
simulador de credito 1.py | Argenta47/talleres_de_algoritmos | 0 | 37978 | # -*- coding: utf-8 -*-
"""
Simulador de credito
- Monto del prestamo del carro
- Ingresa tu cuota inicial
- Ingresos mensuales
- Numero de meses del prestamo
- Datos personales
----------------------------------------
Ingresos mensuales
- 908.526 - 1.000.000 >>>>>>>>>>>>>> 20.000.000
- 1.000.000 -... | 2.0625 | 2 |
py/g1/operations/databases/subscribers/g1/operations/databases/subscribers/parts.py | clchiou/garage | 3 | 37979 | import g1.asyncs.agents.parts
import g1.messaging.parts.subscribers
from g1.apps import parameters
from g1.apps import utils
from g1.asyncs.bases import queues
from g1.bases import labels
# For now these are just aliases.
from g1.messaging.parts.subscribers import make_subscriber_params
from .. import subscribers # p... | 1.960938 | 2 |
mhd/python/plot_over_time_CVS_smart.py | FinMacDov/AMR_code | 0 | 37980 | <gh_stars>0
import csv
import matplotlib.pyplot as plt
from matplotlib import interactive
from matplotlib import rcParams, cycler
from scipy.interpolate import interp1d
from matplotlib.colors import BoundaryNorm
from matplotlib.ticker import MaxNLocator
import img2vid as i2v
import glob
import numpy as np
import os
""... | 1.859375 | 2 |
python_tools/power.py | HowieWang1/myown-tools | 2 | 37981 | import os
import tkinter as tk
from telnetlib import Telnet
import ctp.pdu.apc as apc
class PDUPower():
def __init__(self):
self.window = tk.Tk()
self.pdu1 = tk.IntVar()
self.pdu2 = tk.IntVar()
self.pdu3 = tk.IntVar()
self.pdu4 = tk.IntVar()
self.p1 = t... | 2.453125 | 2 |
33-inheritance.py | MKen212/pymosh | 0 | 37982 | class Mammal:
x = 10
def walk(self):
print("Walking")
# class Dog:
# def walk(self):
# print("Walking")
# class Cat:
# def walk(self):
# print("Walking")
class Dog(Mammal):
def bark(self):
print("Woof, woof!")
class Cat(Mammal):
pass # Just used here as Py... | 3.828125 | 4 |
pluribus/poker/evaluation/__init__.py | keithlee96/pluribus-poker-AI | 113 | 37983 | from .eval_card import EvaluationCard
from .evaluator import Evaluator
from .lookup import LookupTable
| 1.070313 | 1 |
dynamicgem/graph_generation/getAS_nx.py | Sujit-O/dyngem | 0 | 37984 | <reponame>Sujit-O/dyngem<filename>dynamicgem/graph_generation/getAS_nx.py
import networkx as nx
import numpy as np
import os
DATA_DIR = 'as-733'
fnames = sorted(os.listdir(DATA_DIR))
routersD = {}
routerId = 0
file_sno = 1
for curr_file in fnames:
with open(DATA_DIR+ '/' + curr_file) as f:
G = nx.DiGraph... | 2.28125 | 2 |
virtool/validators.py | ReeceHoffmann/virtool | 39 | 37985 | import re
from email_validator import validate_email, EmailSyntaxError
from virtool.users.utils import PERMISSIONS
RE_HEX_COLOR = re.compile("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$")
def strip(value: str) -> str:
"""
Strip flanking whitespace from the passed string. Used to coerce values in Cerberus validators... | 3.203125 | 3 |
guildwars2/guild/__init__.py | n1tr0-5urf3r/GW2Bot | 75 | 37986 | <filename>guildwars2/guild/__init__.py
from .general import GeneralGuild
from .sync import GuildSync
class GuildMixin(GeneralGuild, GuildSync):
pass
| 1.226563 | 1 |
noisyopt/tests/test_noisyopt.py | 42Numeric/noisyopt | 0 | 37987 | import numpy as np
import numpy.testing as npt
import noisyopt
def test_minimize():
deltatol = 1e-3
## basic testing without stochasticity
def quadratic(x):
return (x**2).sum()
res = noisyopt.minimize(quadratic, np.asarray([0.5, 1.0]), deltatol=deltatol)
npt.assert_allclose(res.x, [0.0, 0.... | 2.46875 | 2 |
spielberg/admin.py | carlmjohnson/spielberg | 0 | 37988 | from django.contrib import admin
from .models import SimpleRedirect
@admin.register(SimpleRedirect)
class SimpleRedirectAdmin(admin.ModelAdmin):
list_display = [
'from_url',
'to_url',
'date_created',
'date_modified',
'date_active_start',
'date_active_end',
]
| 1.632813 | 2 |
oo/pessoa.py | thaila52/pythonbirds | 0 | 37989 | class Pessoa:
olhos = 2
def __init__(self, *filhos, nome=None, idade=35):
self.nome = nome
self.idade = idade
self.filhos = list(filhos)
def cumprimentar(self):
return f'Olá{id(self)}'
if __name__ == '__main__':
thaila = Pessoa(nome='Thaila')
junior = Pessoa(thaila,... | 3.8125 | 4 |
tools/pytest/extra/get_issues.py | servo-wpt-sync/web-platform-tests | 4 | 37990 | import json
import py
import textwrap
issues_url = "http://bitbucket.org/api/1.0/repositories/pytest-dev/pytest/issues"
import requests
def get_issues():
chunksize = 50
start = 0
issues = []
while 1:
post_data = {"accountname": "pytest-dev",
"repo_slug": "pytest",
... | 2.53125 | 3 |
tests/bdd/test_environment_loader.py | necromuralist/Machine-Learning-From-Scratch | 0 | 37991 | # coding=utf-8
"""Environment Loader feature tests."""
# from pypi
from expects import (
be_true,
expect
)
from pytest_bdd import (
given,
scenarios,
then,
when,
)
# for testing
from .fixtures import katamari
# software under test
from cse_575.data.common import Environment
# Setup
scenarios... | 2.296875 | 2 |
travel_blog/blog/models.py | kennethlove/travel_blog_livestream | 2 | 37992 | <reponame>kennethlove/travel_blog_livestream
from django.contrib.gis.db import models
from django.core.urlresolvers import reverse
from django.utils import timezone
import markdown
class Post(models.Model):
title = models.CharField(max_length=255)
slug = models.SlugField()
content = models.TextField()
... | 2.296875 | 2 |
pycaishen/user_programs/PycaishenBasicUsage/tickers_and_fields.py | spyamine/pycaishen3 | 1 | 37993 | <gh_stars>1-10
import pandas
from pycaishen.util.loggermanager import LoggerManager
class AbstractReference(object):
"""
Abstract class for reference building
"""
def __init__(self):
self.logger = LoggerManager().getLogger(__name__)
def _csv_to_dataframe(self,csv_file,separator=None):
... | 2.8125 | 3 |
Lectures/PythonClass/P15_python_wordcloud.py | Tim232/Python-Things | 2 | 37994 | <gh_stars>1-10
from collections import Counter
from konlpy.tag import Hannanum
import pytagcloud
f = open('D:\\KYH\\02.PYTHON\\crawled_data\\cbs2.txt', 'r', encoding='UTF-8')
data = f.read()
nlp = Hannanum()
nouns = nlp.nouns(data)
count = Counter(nouns)
tags2 = count.most_common(200)
taglist = pytagcloud.make_tags(... | 3.046875 | 3 |
scripts/pi_scripts/runner.py | No-SF-Work/ayame | 46 | 37995 | import os
import subprocess
from pretty_print import Print_C
class Runner:
run_kases = 3
def __init__(self, scheme, testcases):
self.scheme = scheme
self.testcases = testcases
self.bin_file_template = f"build/test_results/{{testcase}}/bin/{scheme}"
self.myout_template = f"buil... | 2.234375 | 2 |
src/fognode/app.py | hehaichi/dist-fog-c | 0 | 37996 | <filename>src/fognode/app.py
from flask import Flask
from flask import request
app = Flask(__name__)
# Imports
import psutil
from flask import jsonify
import redis
import json
from os import urandom
import hashlib
import docker
from docker import APIClient
import requests
import zipfile
from celery import Celery
from ... | 1.890625 | 2 |
ppgr/__init__.py | PolarPayne/ppgr | 0 | 37997 | from .terminal import write, no_cursor
from .screen import Screen
__all__ = ["write", "no_cursor", "Screen"]
__version__ = "0.5.0"
| 1.203125 | 1 |
tarot_deck.py | Soren98/tarot | 0 | 37998 | import json
from copy import deepcopy
from random import shuffle
cards = ['magician', 'high priestess', 'empress', 'emperor', 'hierophant', 'lovers', 'chariot', 'justice', 'hermit',
'wheel of fortune', 'strength', 'hanged man', 'death', 'temperance', 'devil', 'tower', 'star', 'moon', 'sun',
'judgem... | 2.46875 | 2 |
RL.py | apurva-rai/Reinforcement_Learning | 0 | 37999 | <reponame>apurva-rai/Reinforcement_Learning<filename>RL.py
import numpy as np
#SARSA class that has function to train and test simple treasure finding path
class SARSA:
def __init__(self,a,r,action,reward,Q):
if a is None:
self.a = 0.5
if r is None:
self.r = 0.75
s... | 3.125 | 3 |