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 |
|---|---|---|---|---|---|---|
PIP/Class Program/ClassQuestion5.py | ankitrajbiswal/SEM_5 | 10 | 26800 | '''def operations(a,b,c):
if(c=='+'):
return a+b
elif(c=='-'):
return a-b
elif(c=='*'):
return a*b
elif(c=='/'):
return a/b
elif(c=='%'):
return a%b
elif(c=='**'):
return a**b
elif(c=='//'):
return a//b
else:
... | 4.1875 | 4 |
flaskr/data/data_loader.py | bathlarajat/chartjsExamples | 3 | 26801 | <gh_stars>1-10
import os
import csv
import itertools
from datetime import datetime
class DataLoader:
def __init__(self):
self.file_name = os.path.join(os.getcwd(), 'data', 'covid_19_data.csv')
self.data_set_full = []
self.data_set_grouped = []
def prepare_data_set_full(self):
... | 2.90625 | 3 |
plugins/dnspark.py | mmannerm/ddupdate | 34 | 26802 | <reponame>mmannerm/ddupdate<filename>plugins/dnspark.py
"""
ddupdate plugin updating data on dnspark.com.
See: ddupdate(8)
See: https://dnspark.zendesk.com/hc/en-us/articles/
216322723-Dynamic-DNS-API-Documentation
"""
from ddupdate.ddplugin import ServicePlugin, ServiceError
from ddupdate.ddplugin import ht... | 2.390625 | 2 |
userbot/modules/__helpme.py | sekret666/codeaz | 0 | 26803 | # C O D E A Z/ Samil
from userbot import BOT_USERNAME
from userbot.events import register
# ██████ LANGUAGE CONSTANTS ██████ #
from userbot.language import get_value
LANG = get_value("__helpme")
# ████████████████████████████████ #
@register(outgoing=True, pattern="^.yard[iı]m|^.help")
async def yardim(event):
... | 2.03125 | 2 |
Ex-15.py | gilmartins83/Guanabara-Python | 0 | 26804 | <reponame>gilmartins83/Guanabara-Python
dias = int(input("quantos dias voce deseja alugar o carro? "))
km = float(input("Quantos kilometros você andou? "))
pago = dias * 60 + (km * 0.15)
print("o valor do aluguel do carro foi de R$ {:.2f}" .format(pago))
| 3.640625 | 4 |
cirq/contrib/quimb/density_matrix.py | lilies/Cirq | 3 | 26805 | <reponame>lilies/Cirq<filename>cirq/contrib/quimb/density_matrix.py
from functools import lru_cache
from typing import Sequence, Dict, Union, Tuple, List, Optional, cast, Iterable
import numpy as np
import quimb
import quimb.tensor as qtn
import cirq
@lru_cache()
def _qpos_tag(qubits: Union[cirq.LineQubit, Tuple[ci... | 2.875 | 3 |
plugins/mgba_bridge/script_disassembler/script_disassembler.py | notyourav/the-little-hat | 0 | 26806 | from dataclasses import dataclass
import struct
from typing import Tuple
from plugins.mgba_bridge.script_disassembler.utils import barray_to_u16_hex, u16_to_hex
from plugins.mgba_bridge.script_disassembler.definitions import get_pointer, commands, parameters, get_script_label, used_labels
# Disassembler for tmc scrip... | 2.28125 | 2 |
gcloud/apigw/views/query_task_count.py | ZhuoZhuoCrayon/bk-sops | 1 | 26807 | # -*- coding: utf-8 -*-
"""
Tencent is pleased to support the open source community by making 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community
Edition) available.
Copyright (C) 2017-2020 THL A29 Limited, a Tencent company. All rights reserved.
Licensed under the MIT License (the "License"); you may not use this file except in co... | 1.757813 | 2 |
applications/MultilevelMonteCarloApplication/python_scripts/statistical_variable_utilities.py | lkusch/Kratos | 778 | 26808 | <filename>applications/MultilevelMonteCarloApplication/python_scripts/statistical_variable_utilities.py
# Import Python libraries
import numpy as np
# Import distributed framework
from exaqute import *
try:
init()
except:
pass
try:
computing_units_auxiliar_utilities = int(os.environ["computing_units_auxil... | 2.390625 | 2 |
test/test_maximum_average_subarray_i.py | spencercjh/sync-leetcode-today-problem-python3-example | 0 | 26809 | <filename>test/test_maximum_average_subarray_i.py
solution = MaximumAverageSubarrayI()
assert X == solution.findMaxAverage( ) | 1.679688 | 2 |
test/test_http.py | mikiec84/gaffer | 0 | 26810 | # -*- coding: utf-8 -
#
# This file is part of gaffer. See the NOTICE for more information.
import os
import time
import pytest
import pyuv
from gaffer import __version__
from gaffer.manager import Manager
from gaffer.http_handler import HttpEndpoint, HttpHandler
from gaffer.httpclient import (Server, Process, Proce... | 2.265625 | 2 |
tmi/api/io.py | fish2000/TMI | 0 | 26811 | <reponame>fish2000/TMI<filename>tmi/api/io.py<gh_stars>0
# -*- coding: utf-8 -*-
from __future__ import print_function
from enum import unique
import sys
from clu.enums import AliasingEnum, alias
from clu.exporting import Exporter
exporter = Exporter(path=__file__)
export = exporter.decorator()
@unique
class Status... | 2.03125 | 2 |
Numpy/Num.py | shreejitverma/Data-Scientist | 2 | 26812 | <gh_stars>1-10
# Create list baseball
import numpy as np
baseball = [180, 215, 210, 210, 188, 176, 209, 200]
# Import the numpy package as np
# Create a numpy array from baseball: np_baseball
np_baseball = np.array(baseball)
# Print out type of np_baseball
print(type(np_baseball))
# height is available as a regular... | 3.46875 | 3 |
REMARKs/SolvingMicroDSOPs/Calibration/SetupSCFdata.py | ngkratts/REMARK | 18 | 26813 | <reponame>ngkratts/REMARK
'''
Sets up the SCF data for use in the SolvingMicroDSOPs estimation.
'''
from __future__ import division # Use new division function
from __future__ import print_function
from __future__ import absolute_import
from builtins import zip
from builtins import str
from builtins import range
... | 2.34375 | 2 |
build/lib/app/routes.py | Dialjini/BarsCrm_backend | 0 | 26814 | from app import app
from flask import render_template, redirect, session, request, send_from_directory
from app import models, db, reqs
from flask_socketio import SocketIO, emit
import json
from xhtml2pdf import pisa
import os
from datetime import datetime
socketio = SocketIO(app)
if __name__ == '__main__':
socke... | 2.34375 | 2 |
ch2Perceptron/example2.py | junseokpark/deepLearningFromScratch | 0 | 26815 | import numpy as np
x = np.array([0,1])
w = np.array([0.5,0.5])
b = -0.7
print(w*x)
print(np.sum(w*x))
print(np.sum(w*x)+b)
def AND(x1,x2):
x = np.array([x1,x2])
w = np.array([0.5,0.5])
b = -0.7
tmp = np.sum(w*x)+b
if tmp <= 0:
return 0
else:
return 1
def NAND(x1,x2):
x = n... | 3.296875 | 3 |
model/custom_resnet.py | gkdivya/torch-cv-wrapper | 2 | 26816 | import torch
import torch.nn as nn
import torch.nn.functional as F
class BasicBlock(nn.Module):
def __init__(self, in_planes, planes, stride=1):
super(BasicBlock, self).__init__()
self.conv1 = nn.Conv2d(
in_planes, planes, kernel_size=3, stride=stride, padding=1, bias=False)
s... | 2.953125 | 3 |
playground/test_condconv_weights/test_routing_weights.py | harry11162/detectron2 | 0 | 26817 | #!/usr/bin/env python
# Copyright (c) Facebook, Inc. and its affiliates.
"""
Detectron2 training script with a plain training loop.
This script reads a given config file and runs the training or evaluation.
It is an entry point that is able to train standard models in detectron2.
In order to let one script support tr... | 2.34375 | 2 |
ocean_drifters_data/buoy_data.py | nglaze00/trajectory-analysis | 4 | 26818 | """
Author: <NAME>, Rice ECE (nkg2 at rice.edu)
Code for converting ocean drifter data from Schaub's format to ours.
"""
import h5py
from trajectory_analysis.synthetic_data_gen import *
dataset_folder = 'buoy'
f = h5py.File('dataBuoys.jld2', 'r')
print(f.keys())
### Load arrays from file
## Graph
# elist (edge l... | 2.21875 | 2 |
Latest/venv/Lib/site-packages/apptools/permissions/default/user_manager.py | adamcvj/SatelliteTracker | 1 | 26819 | <gh_stars>1-10
#------------------------------------------------------------------------------
# Copyright (c) 2008, Riverbank Computing Limited
# All rights reserved.
#
# This software is provided without warranty under the terms of the BSD
# license included in enthought/LICENSE.txt and may be redistributed only
# un... | 1.765625 | 2 |
libraries/exhibitions/apps.py | chris-lawton/libraries_wagtail | 9 | 26820 | <reponame>chris-lawton/libraries_wagtail
from django.apps import AppConfig
class ExhibitionsConfig(AppConfig):
name = 'exhibitions'
| 1.390625 | 1 |
2-1_factorial_Q1_recursive.py | Soooyeon-Kim/Algorithm | 0 | 26821 | def factorial(num):
# 재귀함수를 세울 때는 탈출 조건부터 찾는다.
if num <= 1:
return 1
return factorial(num - 1) * num
def main():
print(factorial(5))
# return 120
if __name__ == "__main__":
main() | 3.875 | 4 |
PyPoll/main.py | adekted/python-challenge | 0 | 26822 | import os
import csv
pollresults = os.path.join(".","raw_data","election_data_1.csv")
output = os.path.join(".","results.txt")
with open(pollresults, newline = '') as polldata:
pollreader = csv.reader(polldata, delimiter = ",")
firstline = polldata.readline()
votes = 0
poll_results = {}
for row... | 3.046875 | 3 |
ReinforcementLearning/ExperienceReplay.py | Suryavf/SelfDrivingCar | 11 | 26823 | <filename>ReinforcementLearning/ExperienceReplay.py
import numpy as np
from common.prioritized import PrioritizedExperienceReplay
class ReplayMemory(object):
def __init__(self, n_buffer,len_state,len_action):
# Parameters
self.n_buffer = n_buffer
self.len_state = len_state
... | 2.984375 | 3 |
domdf_python_tools/dates.py | domdfcoding/domdf_python_tools | 0 | 26824 | # !/usr/bin/env python
#
# dates.py
"""
Utilities for working with dates and times.
.. extras-require:: dates
:pyproject:
**Data:**
.. autosummary::
~domdf_python_tools.dates.months
~domdf_python_tools.dates.month_full_names
~domdf_python_tools.dates.month_short_names
"""
#
# Copyright © 2020 <NAME> <<EMAI... | 1.671875 | 2 |
admix/tasks/check_transfers.py | XENONnT/admix | 2 | 26825 | <gh_stars>1-10
# -*- coding: utf-8 -*-
import json
import os
from admix.helper import helper
import time
import shutil
from admix.interfaces.database import ConnectMongoDB
from admix.helper.decorator import Collector
#get Rucio imports done:
from admix.interfaces.rucio_dataformat import ConfigRucioDataFormat
from adm... | 2.234375 | 2 |
fantastico/mvc/models/tests/test_module_filter_compound_or.py | bopopescu/fantastico | 2 | 26826 | '''
Copyright 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 limitation
the rights to use, copy, modify, merge, publish, distribute, sublicens... | 1.734375 | 2 |
main.py | AlexanderBrandborg/TextGameEngine | 0 | 26827 | import json
import os
class Notifyer():
def __init__(self):
self.subscribers = []
def add_subscriber(self, subscriber):
self.subscribers.append(subscriber)
def notify(self, triggerId):
for sub in self.subscribers:
sub.notify(triggerId)
global_characters = []
global_it... | 2.6875 | 3 |
sdks/python/appcenter_sdk/models/InternalHockeyAppCompatibilityResponse.py | Brantone/appcenter-sdks | 0 | 26828 | <gh_stars>0
# coding: utf-8
"""
App Center Client
Microsoft Visual Studio App Center API # noqa: E501
OpenAPI spec version: preview
Contact: <EMAIL>
Project Repository: https://github.com/b3nab/appcenter-sdks
"""
import pprint
import re # noqa: F401
import six
class InternalHockeyAppCompati... | 1.664063 | 2 |
contrib/experiments/interpretation/penobscot/local/default.py | elmajdma/seismic-deeplearning | 270 | 26829 | <gh_stars>100-1000
# ------------------------------------------------------------------------------
# Copyright (c) Microsoft
# Licensed under the MIT License.
# ------------------------------------------------------------------------------
from __future__ import absolute_import
from __future__ import division
from __... | 1.664063 | 2 |
evaluation/dwf_power.py | TrustedThings/litepuf | 0 | 26830 | <filename>evaluation/dwf_power.py
from ctypes import *
from dwfconstants import *
dwf = cdll.LoadLibrary("libdwf.so")
hdwf = c_int()
dwf.FDwfParamSet(DwfParamOnClose, c_int(0)) # 0 = run, 1 = stop, 2 = shutdown
print("Opening first device")
dwf.FDwfDeviceOpen(c_int(-1), byref(hdwf))
if hdwf.value == hdwfNone.value:
... | 2.625 | 3 |
src/backend/common/sitevars/flask_secrets.py | ofekashery/the-blue-alliance | 266 | 26831 | from typing import TypedDict
from backend.common.sitevars.sitevar import Sitevar
class ContentType(TypedDict):
secret_key: str
class FlaskSecrets(Sitevar[ContentType]):
DEFAULT_SECRET_KEY: str = "thebluealliance"
@staticmethod
def key() -> str:
return "flask.secrets"
@staticmethod
... | 2.4375 | 2 |
cornflow-server/migrations/versions/f3bee20314a2_.py | ggsdc/corn | 2 | 26832 | """
Added DAG master table and DAG permissions table
Revision ID: f3bee20314a2
Revises: <KEY>
Create Date: 2021-12-14 14:41:16.096297
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = "f3bee20314a2"
down_revision = "<KEY>"
branch_labels = None
depends_on = None
... | 1.617188 | 2 |
autoPyTorch/core/autonet_classes/autonet_feature_data.py | thomascherickal/Auto-PyTorch | 1 | 26833 |
__author__ = "<NAME>, <NAME> and <NAME>"
__version__ = "0.0.1"
__license__ = "BSD"
from autoPyTorch.core.api import AutoNet
class AutoNetFeatureData(AutoNet):
@classmethod
def get_default_pipeline(cls):
from autoPyTorch.pipeline.base.pipeline import Pipeline
from autoPyTorch.pipeline.nodes.a... | 2.15625 | 2 |
src/dispatch/incident_priority/service.py | mclueppers/dispatch | 1 | 26834 | from typing import List, Optional
from fastapi.encoders import jsonable_encoder
from sqlalchemy.sql.expression import true
from .models import IncidentPriority, IncidentPriorityCreate, IncidentPriorityUpdate
def get(*, db_session, incident_priority_id: int) -> Optional[IncidentPriority]:
"""Returns an incident ... | 2.4375 | 2 |
Ex036.py | andrade-lcs/ex_curso_em_video_python | 0 | 26835 | <filename>Ex036.py
from time import sleep
aa = 0
print('\033[2;31;40m-=\033[m'*40)
while aa == 0:
print('Este software ira calcular seu financiamento')
sleep(1)
a = float(input('Qual é a sua renda mensal? R$'))
sleep(1)
b = float(input('Qual é o valor do imóvel? R$'))
sleep(1)
c = float(inpu... | 3.75 | 4 |
neuralnetworksanddeeplearning_michael_nielsen/chapter_1/0020_single_perceptron_as_NAND.py | researcherben/learn_machine_learning | 0 | 26836 | '''
Single perceptron can replicate a NAND gate
https://en.wikipedia.org/wiki/NAND_logic
inputs | output
0 0 1
0 1 1
1 0 1
1 1 0
'''
def dot_product(vec1,vec2):
if (len(vec1) != len(vec2)):
print("input vector lengths are not equal")
print(len(vec1))
print(len(vec2))
reslt=0
for... | 3.6875 | 4 |
job-search/Indeed_Scraper.py | oscarevolves/JobSearch_WebScraper | 2 | 26837 | <filename>job-search/Indeed_Scraper.py<gh_stars>1-10
#!/usr/bin/python
# Author: <NAME>
from bs4 import BeautifulSoup
import re
import pandas as pd
import requests
#-------------------------------------------------
# Making the Soup
#-------------------------------------------------
def format_page():
print("F... | 3.4375 | 3 |
tests/acknowledge/acknowledge.py | orenyodfat/CWR-DataApi | 37 | 26838 | __author__ = 'yaroslav'
| 0.957031 | 1 |
mangopi/tests/site/test_mangaFox.py | BFTeck/mangopi | 24 | 26839 | <reponame>BFTeck/mangopi<gh_stars>10-100
from unittest import TestCase
from mangopi.site.mangafox import MangaFox
class TestMangaFox(TestCase):
SERIES = MangaFox.series('gantz')
CHAPTERS = SERIES.chapters
def test_chapter_count(self):
self.assertEqual(len(TestMangaFox.CHAPTERS), 386)
def te... | 2.640625 | 3 |
src/core/service/extractor.py | Mahe1980/btb | 0 | 26840 | <filename>src/core/service/extractor.py
import json
import pandas as pd
import re
from pathlib import Path
from src.core.connectors.connectors import get_nz_conn
from src.settings.envs import NZ_TO_DATASET_DTYPE_MAPPING
from src.settings import envs
from src.settings import log_config
import logging
logger = logging.g... | 2.578125 | 3 |
mmdet/ops/nms_rotated/nms_rotated_wrapper.py | vpeopleonatank/OBBDetection | 274 | 26841 | <reponame>vpeopleonatank/OBBDetection
import BboxToolkit as bt
import numpy as np
import torch
from . import nms_rotated_ext
def obb2hbb(obboxes):
center, w, h, theta = torch.split(obboxes, [2, 1, 1, 1], dim=1)
Cos, Sin = torch.cos(theta), torch.sin(theta)
x_bias = torch.abs(w/2 * Cos) + torch.abs(h/2 * ... | 1.914063 | 2 |
StreamPy/StreamPy-UI/src/root/nested/temp/MakeNetwork(1).py | AnomalyInc/StreamPy | 2 | 26842 | from Stream import Stream
from Stream import _no_value, _multivalue
from Agent import Agent
from root.nested.OperatorsTestNew import stream_agent
def make_network(stream_names_tuple, agent_descriptor_dict):
""" This function makes a network of agents given the names
of the streams in the network and a descript... | 3.0625 | 3 |
pyfuntofem/base.py | anilyil/funtofem | 0 | 26843 | #!/usr/bin/env python
# This file is part of the package FUNtoFEM for coupled aeroelastic simulation
# and design optimization.
# Copyright (C) 2015 Georgia Tech Research Corporation.
# Additional copyright (C) 2015 <NAME>, <NAME> and <NAME>.
# All rights reserved.
# FUNtoFEM is licensed under the Apache License, Ve... | 2.609375 | 3 |
shell/core/backdoors.py | theralfbrown/shellsploit-framework | 3 | 26844 | from color import *
#Will be add command line params ..
def backdoorlist( require=False):
if require != False:
data = [
"linux/x86/reverse_tcp",
"linux/x64/reverse_tcp",
"osx/x86/reverse_tcp",
"osx/x64/reverse_tcp",
"windows/x86/reverse_tcp",
"php/reverse_tcp",
"asp/reverse_tcp",
"jsp/reverse_tcp"... | 2.4375 | 2 |
circuit_mapper/gate_1_qubit.py | quantumgenetics/quantumgenetics | 6 | 26845 | #!/usr/bin/env python3
from functools import partial
def combine(qubit_count, gates):
return [partial(g, i) for g in gates for i in range(qubit_count)]
def repeat_none(index, count):
return [partial(apply_none, index)] * count
def apply_none(index, circuit):
pass
def apply_not(index, circuit):
qr... | 2.484375 | 2 |
stronghold/tests/testmixins.py | davitovmasyan/django-stronghold | 252 | 26846 | from stronghold.views import StrongholdPublicMixin
import django
from django.views.generic import View
from django.views.generic.base import TemplateResponseMixin
if django.VERSION[:2] < (1, 9):
from django.utils import unittest
else:
import unittest
class StrongholdMixinsTests(unittest.TestCase):
def ... | 2.078125 | 2 |
app/utils/mapping.py | bbc/connected-data-pseudocone | 0 | 26847 | <filename>app/utils/mapping.py<gh_stars>0
import datetime
import logging
import isodate
from app import pseudocone_pb2
from app.settings import SERVICE_NAME
logger = logging.getLogger(SERVICE_NAME)
def action_context_to_iso8601_duration(action_context):
"""Process the actionContext string to ISO 8601 duration ... | 2.765625 | 3 |
paper_iv/centrality_example.py | wiheto/phd_code | 2 | 26848 | <gh_stars>1-10
import numpy as np
import teneto
import matplotlib.pyplot as plt
plt.rcParams['image.cmap'] = 'gist_gray'
A=np.zeros((3,3,20))
A[0,2,0:4]=1
A[0,1,0]=1
A[0,1,5]=1
A[0,1,10]=1
A[0,1,15]=1
fig,ax = plt.subplots(1)
ax = teneto.plot.slice_plot(A,ax,vlabs=range(1,4),dlabs=range(1,21))
ax.set_ylabel('node... | 2.328125 | 2 |
examples/hsd_struct/src/hsd_struct_beh.py | hnikolov/pihdf | 2 | 26849 | def hsd_struct_beh(mode_1, mode_2, LEDs, LED_rdy_en, LED_rdy_buff, LED_rdy_out, DELAY_BITS, BUFFER_SIZE):
'''|
| Specify the behavior, describe data processing; there is no notion
| of clock. Access the in/out interfaces via get() and append()
| methods. The "hsd_struct_beh" function does not return val... | 2.765625 | 3 |
tests/unit/test_non-lib_utils.py | DiwakerJha/acconeer-python-exploration | 0 | 26850 | import sys
from itertools import chain
from pathlib import Path
import pytest
import acconeer.exptool as et
HERE = Path(__file__).parent
path = (HERE / ".." / ".." / "utils").resolve()
sys.path.append(path.as_posix())
from convert_to_csv import record_to_csv # noqa: E402
@pytest.mark.parametrize("test_file", ch... | 2.515625 | 3 |
pydis_site/apps/api/migrations/0055_reminder_mentions.py | Numerlor/site | 700 | 26851 | <filename>pydis_site/apps/api/migrations/0055_reminder_mentions.py
# Generated by Django 2.2.14 on 2020-07-15 07:37
import django.contrib.postgres.fields
import django.core.validators
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('api', '0054_user_inva... | 1.773438 | 2 |
kantanoidc/views.py | mmiyajima2/django-kantanoidc | 0 | 26852 | <reponame>mmiyajima2/django-kantanoidc
from logging import getLogger
from django.http import HttpResponseRedirect
from django.views.generic.base import View
from django.contrib.auth import login
from django.contrib.auth import get_user_model
from django.urls import reverse
from .client import client
from .errors import... | 1.960938 | 2 |
hata/ext/extension_loader/client_extension.py | Multiface24111/hata | 173 | 26853 | <gh_stars>100-1000
__all__ = ()
from ...backend.utils import KeepType
from ...discord.client import Client
from .extension import EXTENSIONS, EXTENSION_STATE_LOADED
@KeepType(Client)
class Client:
@property
def extensions(self):
"""
Returns a list of extensions added to the client. Added by ... | 2.328125 | 2 |
org/miggy/setup.py | DarkSession/fd-api | 20 | 26854 | <reponame>DarkSession/fd-api
# vim: textwidth=0 wrapmargin=0 tabstop=2 shiftwidth=2 softtabstop=2 smartindent smarttab
from setuptools import setup, find_namespace_packages
setup(
name="org.miggy",
packages=find_namespace_packages()
)
| 1.070313 | 1 |
day-04/part-1/badouralix.py | evqna/adventofcode-2020 | 12 | 26855 | <filename>day-04/part-1/badouralix.py<gh_stars>10-100
from tool.runners.python import SubmissionPy
class BadouralixSubmission(SubmissionPy):
def run(self, s):
"""
:param s: input in string format
:return: solution flag
"""
result = 0
for line in s.split("\n\n"):
... | 2.734375 | 3 |
s2e_env/manage.py | michaelbrownuc/s2e-env | 0 | 26856 | """
Copyright (c) Django Software Foundation and individual contributors.
Copyright (c) Dependable Systems Laboratory, EPFL
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
1. Redistributions of sour... | 1.46875 | 1 |
src/interface/vib_main.py | stembl/vibproc | 0 | 26857 | <reponame>stembl/vibproc
## Main Program for Vibration Analysis with Pandas
import sys, os
import matplotlib.pyplot as plt
#sys.path.append(os.path.join(os.path.dirname(__file__), "../tools/"))
sys.path.append("../tools/")
sys.path.append("../../data/")
from open_file_folder import *
from import_vib_data import *
f... | 2.703125 | 3 |
Lesson 02 - Arrays/OddOccurrencesInArray_3.py | kourouklides/codility-python | 11 | 26858 | # you can write to stdout for debugging purposes, e.g.
# print("this is a debug message")
def solution(A):
# write your code in Python 3.6
dictionary = {}
for number in A:
if dictionary.get(number) == None:
dictionary[number] = 1
else:
dictionary[number] += 1
for ke... | 3.71875 | 4 |
MANN/Utils/similarities.py | jgyllinsky/How-to-Learn-from-Little-Data | 161 | 26859 | import tensorflow as tf
def cosine_similarity(x, y, eps=1e-6):
z = tf.batch_matmul(x, tf.transpose(y, perm=[0,2,1]))
z /= tf.sqrt(tf.multiply(tf.expand_dims(tf.reduce_sum(tf.multiply(x,x), 2), 2),tf.expand_dims(tf.reduce_sum(tf.multiply(y,y), 2), 1)) + eps)
return z
| 2.734375 | 3 |
PythonAPI/quickstart/03-raycast.py | MaisJamal/Apollo-BT-GP | 0 | 26860 | #!/usr/bin/env python3
#
# Copyright (c) 2019 LG Electronics, Inc.
#
# This software contains code licensed as described in LICENSE.
#
import os
import lgsvl
sim = lgsvl.Simulator(os.environ.get("SIMULATOR_HOST", "127.0.0.1"), 8181)
if sim.current_scene == "BorregasAve":
sim.reset()
else:
sim.load("BorregasAve")
... | 2.796875 | 3 |
app/run.py | mourgaya/iscsi_ihm | 0 | 26861 | #author : <NAME>
#
import commands
from flask import jsonify
from flask import Flask, Response, request, redirect,session, url_for
from flask.ext.login import LoginManager, UserMixin,login_required, login_user, logout_user
<EMAIL>
#def treat_as_plain_text(response):
# response.headers["content-type"] = "text/plain;... | 2.609375 | 3 |
src/config/defaults/sc2/config.py | ewanlee/mackrl | 26 | 26862 | <reponame>ewanlee/mackrl
def get_cfg(existing_cfg, _log):
"""
generates
"""
_sanity_check(existing_cfg, _log)
import ntpath, os, yaml
with open(os.path.join(os.path.dirname(__file__), "{}.yml".format(ntpath.basename(__file__).split(".")[0])),
'r') as stream:
try:
... | 2.453125 | 2 |
analyser/utils/data_loader.py | michigg/web-simultaneous-recording-tool | 1 | 26863 | <reponame>michigg/web-simultaneous-recording-tool<filename>analyser/utils/data_loader.py<gh_stars>1-10
import glob
import json
import pandas as pd
from models.analysis import Analysis
from models.devices import Devices
import logging
logger = logging.getLogger(__name__)
class Loader:
@staticmethod
def load... | 2.53125 | 3 |
catstuff/tools/argparser.py | modora/catstuff | 0 | 26864 | import argparse, sys
__version__ = '1.0.2'
class CSArgParser(argparse.ArgumentParser):
""" Argument parser that shows help if there is an error """
def error(self, message, exit=False):
sys.stderr.write('Error: {}\n'.format(message))
self.print_help()
if exit:
sys.exit(2)
| 3.21875 | 3 |
custom_components/google_home/sensor.py | tmttn/home-assistant-config | 1 | 26865 | """Sensor platform for Google Home"""
from __future__ import annotations
import logging
import voluptuous as vol
from homeassistant.config_entries import ConfigEntry
from homeassistant.const import DEVICE_CLASS_TIMESTAMP, STATE_UNAVAILABLE
from homeassistant.core import HomeAssistant
from homeassistant.helpers impor... | 1.976563 | 2 |
ContinuumBenchmarks/MNIST/Continual-Learning-Benchmark/Plot.py | hikmatkhan/Continuum | 0 | 26866 | <reponame>hikmatkhan/Continuum
import torch
import pandas as pd
# "Avg_NormalNN",
Approaches = ["NormalNN", "EWC",
"SI", "L2", "Naive_Rehearsal_1100", "Naive_Rehearsal_4400",
"MAS", "GEM_1100", "GEM_4400"
]
REPEAT = 10
OutDirPath = "/home/hikmat/Desktop/JWorkspace/CL/Continuum/... | 2.390625 | 2 |
fmojinja/awk/__main__.py | Taro-Imahiro/fmojinja | 0 | 26867 | <reponame>Taro-Imahiro/fmojinja<gh_stars>0
from ..mixin import SubCommands
from .pdb_reformer import PdbReformer
SubCommands.main_proc({
"pdb_reformer": PdbReformer
})
| 1.25 | 1 |
src/home_automation_hub/storage.py | levidavis/py-home | 26 | 26868 | import redis
import json
from . import config
redis_instance = None
def set_up(host, port, db):
global redis_instance
redis_instance = redis.StrictRedis(host=host, port=port, db=db)
class ModuleStorage():
def __init__(self, module_id):
self.key_prefix = "module:" + config.config.enabled_modules... | 2.671875 | 3 |
example/abc-preview.py | lochbrunner/vscode-generic-binary-preview | 1 | 26869 | #!/usr/bin/env python
import argparse
import os
import sys
import pickle
if __name__ == "__main__":
parser = argparse.ArgumentParser()
parser.add_argument('filename')
args = parser.parse_args()
if os.path.splitext(args.filename)[1] != '.abc':
# We can not read this file type
sys.exit(... | 3.46875 | 3 |
obsolete/pipeline_mapping_benchmark.py | cdrakesmith/CGATPipelines | 49 | 26870 | """=========================================
Read Mapping parameter titration pipeline
=========================================
* align reads to the genome using a range of different parameters
* calculate alignment statistics
Requirements
------------
On top of the default CGAT setup, the pipeline requires ... | 2.078125 | 2 |
user_Test.py | Robertokello11/Password-Locker | 0 | 26871 | <filename>user_Test.py
import unittest #Import unittest module
from user import user # importing the contact class
class TestUser(unittest.TestCase):
def setUp(self):
'''
method to run before each test
'''
self.new_user=User("Robert", "<PASSWORD>ert11") #new User created
def... | 3.671875 | 4 |
src/old/api_server.py | ssupdoc/k8-simulation | 0 | 26872 | from src.deployment import Deployment
from src.end_point import EndPoint
from src.etcd import Etcd
from src.pod import Pod
from src.pid_controller import PIDController
from src.request import Request
from src.worker_node import WorkerNode
import threading
import random
#The APIServer handles the communication between ... | 2.390625 | 2 |
ngram_graphs/TextGraph/IGraphTextGraph.py | loginn/ngrams_graphs | 8 | 26873 | <filename>ngram_graphs/TextGraph/IGraphTextGraph.py
from igraph import Graph
def find_node_name(graph, node_idx):
return graph.vs[node_idx]["name"]
class IGraphTextGraph(Graph):
def __init__(self):
super().__init__(directed=True)
def __copy__(self):
g = IGraphTextGraph()
for v i... | 2.921875 | 3 |
Python Crash Course/12_use_module.py | rfaria/full-stack-python | 1 | 26874 | import new_module as nm
if __name__ == '__main__':
nm.say_hi() | 1.164063 | 1 |
pyFiDEL/utils.py | sungcheolkim78/pyFiDEL | 0 | 26875 | <reponame>sungcheolkim78/pyFiDEL<gh_stars>0
'''
utils.py - utility functions
Soli Deo Gloria
'''
__author__ = '<NAME>'
__version__ = '1.0.0'
import numpy as np
def fermi_l(x: np.array, l1: float, l2: float) -> np.array:
''' calculate fermi-dirac distribution with np.array x with l1 and l2'''
return 1. / (... | 2.390625 | 2 |
scripts/run_jsw_ablation_experiments.py | Oulu-IMEDS/OAProgression | 65 | 26876 | <filename>scripts/run_jsw_ablation_experiments.py
import sys
import os
import cv2
import argparse
import pickle
from sklearn.metrics import average_precision_score
from sklearn.model_selection import GroupKFold
from oaprogression.metadata.oai import jsw_features, read_jsw_metadata_oai, beam_angle_feature
from oaprogr... | 2.15625 | 2 |
data/synthetic/analyze.py | thonic/pyhawkes | 221 | 26877 | import gzip
import pickle
import os
def analyze(data_path):
"""
Run the comparison on the given data file
:param data_path:
:return:
"""
if data_path.endswith(".gz"):
with gzip.open(data_path, 'r') as f:
S, true_model = pickle.load(f)
else:
with open(data_path... | 2.78125 | 3 |
icarus/test/test_util.py | oascigil/icarus_edge_comp | 5 | 26878 | <gh_stars>1-10
import unittest
import networkx as nx
import fnss
import icarus.util as util
class TestUtil(unittest.TestCase):
@classmethod
def setUpClass(cls):
pass
@classmethod
def tearDownClass(cls):
pass
def setUp(self):
pass
def tearDown(self):
pass
... | 2.515625 | 3 |
pytorch_metric_learning/trainers/unsupervised_embeddings_using_augmentations.py | jacobdanovitch/pytorch_metric_learning | 1 | 26879 | <reponame>jacobdanovitch/pytorch_metric_learning
from .metric_loss_only import MetricLossOnly
import logging
from ..utils import common_functions as c_f
import torch
class UnsupervisedEmbeddingsUsingAugmentations(MetricLossOnly):
def __init__(self, transforms, **kwargs):
super().__init__(**kwargs)
... | 2.078125 | 2 |
accelerator/migrations/0064_update_gender_criteria_to_full_gender_spec.py | masschallenge/django-accelerator | 6 | 26880 | <reponame>masschallenge/django-accelerator
# Generated by Django 2.2.24 on 2021-07-01 20:17
from django.db import migrations
def update_criterion_specs(apps, schema_editor):
CriterionOptionSpec = apps.get_model("accelerator", "CriterionOptionSpec")
CriterionOptionSpec.objects.filter(option="m").update(option... | 1.898438 | 2 |
task8.py | akramnarejo/pycode | 0 | 26881 | <filename>task8.py
import random
def choice(choice):
""" This function takes in integer value and returns the equivalent string """
if(choice == 1):
return "Rock"
elif(choice == 2):
return "Paper"
else:
return "Scissors"
def determine(userChoice, computerChoice):
"""
... | 4.3125 | 4 |
rl_coach/graph_managers/hrl_graph_manager.py | jl45621/coach | 1,960 | 26882 | <reponame>jl45621/coach
#
# Copyright (c) 2017 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 app... | 1.984375 | 2 |
test_21_recent_filelist.py | Mpreyzner/tdd_in_python | 0 | 26883 | <reponame>Mpreyzner/tdd_in_python
# https://sites.google.com/site/tddproblems/all-problems-1/recent-file-list
# A popular feature of graphical editors of
# all kinds (text, graphics, spreadsheets, ..) is the Recent file list. It is often found as a sub-menu of the file
# menu in the GUI of the program.
#
# Use TDD to g... | 3.203125 | 3 |
tests/utils.py | amatissart/idunn | 0 | 26884 | <gh_stars>0
from contextlib import contextmanager
from copy import deepcopy
from app import settings
@contextmanager
def override_settings(overrides):
"""
A utility function used by some fixtures to override settings
"""
old_settings = deepcopy(settings._settings)
settings._settings.update(override... | 1.96875 | 2 |
exp01_string.py | psb2509/learning-python3 | 0 | 26885 | print(4+3);
print("Hello");
print('Who are you');
print('This is Pradeep\'s python program');
print(r'C:\Users\N51254\Documents\NetBeansProjects');
print("Pradeep "*5); | 2.921875 | 3 |
parse.py | OpenScienceFramework/citations | 4 | 26886 | <reponame>OpenScienceFramework/citations
# encoding: utf-8
"""
Parse module for parsing citations into structured data. Currently this uses
the Parsley library to do this, the grammars are defined in the grammars/
folder and cycled through until one is found that works.
to_dict will convert the Reference named tuple i... | 2.828125 | 3 |
src/utils/config.py | cpaismz89/DeepFireTopology | 0 | 26887 | # Run Keras on CPU
import os
# os.environ["CUDA_DEVICE_ORDER"] = "PCI_BUS_ID" # see issue #152
# os.environ["CUDA_VISIBLE_DEVICES"] = " " # -1 if CPU
# Importations
from IPython.display import Image
# Compressed pickle
import pickle
from compress_pickle import dump as cdump
from compress_pickle import load ... | 1.921875 | 2 |
openstack_dashboard/test/integration_tests/steps.py | Mirantis/mos-horizon | 9 | 26888 | # 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, software
# d... | 1.789063 | 2 |
src/zabbix_enums/common/event.py | szuro/zabbix-enums | 1 | 26889 | <gh_stars>1-10
from zabbix_enums.common import _ZabbixEnum
class EventSeverity(_ZabbixEnum):
NOT_CLASSIFIED = 0
INFORMATION = 1
WARNING = 2
AVERAGE = 3
HIGH = 4
DISASTER = 5
class EventSuppressed(_ZabbixEnum):
NO = 0
YES = 1
class EventObjectTrigger(_ZabbixEnum):
TRIGGER = 0
... | 1.84375 | 2 |
tests/test_next_step_assignment_udf.py | EdinburghGenomics/clarity_scripts | 2 | 26890 | <reponame>EdinburghGenomics/clarity_scripts
from unittest.mock import patch, PropertyMock, Mock
import pytest
from EPPs.common import StepEPP
from tests.test_common import TestEPP, NamedMock
from scripts.next_step_assignment_udf import AssignNextStepUDF
class TestNextStepAssignmentUDF(TestEPP):
step_udfs1={'st... | 2.28125 | 2 |
haul2/src/__init__.py | hotkeymuc/haul2 | 0 | 26891 | <reponame>hotkeymuc/haul2
__all__ = ["htk"] | 1.15625 | 1 |
test_opencv_haar_img.py | sunnylgz/faceapi | 0 | 26892 | <reponame>sunnylgz/faceapi
#! /usr/bin/python3
"""find faces from input image based on mtcnn and locate the locations and landmarks
"""
# MIT License
#
# Copyright (c) 2016 <NAME>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (th... | 1.898438 | 2 |
sphinx-sources/Examples/ComputerPrac/FresnelPlane.py | jccmak/lightpipes | 132 | 26893 | #!/usr/bin/env python
"""
Computer practical 6.1. Fresnel diffraction, plane wavefront.
=============================================================
This is part of the 'computer practical' set of assignments.
Demonstrates Fresnel diffraction when a plane wavefront enters
a round hole.
Measur... | 3.53125 | 4 |
scripts/sliding_window.py | gustaveroussy/98drivers | 0 | 26894 | <filename>scripts/sliding_window.py<gh_stars>0
import argparse
import tabix
import os
from common import *
def sliding_window(tabix_file, genom, window ):
sizes = chromosom_sizes(genom)
tx = tabix.open(tabix_file)
for chromosom in sizes:
for position in range(0,sizes[chromosom] - window, window):
start... | 2.921875 | 3 |
examples/tornado/myapp/__init__.py | s-shin/wswrapper | 2 | 26895 | # -*- coding: utf-8 -*-
def setup_argparser(parser):
"""コマンドパーサーのセットアップ。
パーサーは共有されるので、被らないように上手く調整すること。
:param parser: ``argparse.ArgumentParser`` のインスタンス。
"""
pass
def setup_app(args):
"""コマンドパース後のセットアップ。
:param args: ``parser.arg_parse()`` の戻り値。
"""
pass
def on_open(... | 2.390625 | 2 |
src/Bank.py | tokuma09/PyTDD | 0 | 26896 | <gh_stars>0
class Bank():
def __init__(self):
pass
def reduce(self, source, to):
return source.reduce(to)
| 2.5 | 2 |
test/clean_directory.py | adevress/gfal2 | 0 | 26897 | #!/usr/bin/env python
import gfal2
import logging
import optparse
import stat
import sys
log = logging.getLogger('gfal2.clean_directory')
class Cleaner(object):
def __init__(self, abort_on_error=False, recursive=False, only_files=False, chmod=False):
self.abort_on_error = abort_on_error
self.rec... | 2.5 | 2 |
app/views/recipe.py | baldur132/essensfindung | 1 | 26898 | """Router and Logic for the Recipe of the Website"""
from datetime import timedelta
from typing import Union
import fastapi
from fastapi.responses import HTMLResponse
from sqlalchemy.orm import Session
from starlette.requests import Request
from starlette.templating import Jinja2Templates
from db.database import get_... | 2.703125 | 3 |
platform/radio/efr32_multiphy_configurator/pyradioconfig/parts/viper/calculators/calc_utilities.py | PascalGuenther/gecko_sdk | 69 | 26899 | <reponame>PascalGuenther/gecko_sdk
from pyradioconfig.parts.bobcat.calculators.calc_utilities import Calc_Utilities_Bobcat
from pycalcmodel.core.variable import ModelVariableFormat
from enum import Enum
class Calc_Utilities_Viper(Calc_Utilities_Bobcat):
def buildVariables(self, model):
#Build all variables... | 2.53125 | 3 |