max_stars_repo_path stringlengths 3 269 | max_stars_repo_name stringlengths 4 119 | max_stars_count int64 0 191k | id stringlengths 1 7 | content stringlengths 6 1.05M | score float64 0.23 5.13 | int_score int64 0 5 |
|---|---|---|---|---|---|---|
tests/test_security.py | jaraco/jaraco.windows | 21 | 12780551 | from jaraco.windows import security
def test_get_security_attributes_for_user():
security.get_security_attributes_for_user()
| 1.375 | 1 |
keylime/tornado_requests.py | mit-ll/MIT-keylime | 0 | 12780552 | #!/usr/bin/env python3
'''
SPDX-License-Identifier: BSD-2-Clause
Copyright 2017 Massachusetts Institute of Technology.
'''
import asyncio
import json
import yaml
try:
from yaml import CSafeLoader as SafeLoader, CSafeDumper as SafeDumper
except ImportError:
from yaml import SafeLoader as SafeLoader, SafeDumper... | 2.296875 | 2 |
condor/particle/particle_map.py | Toonggg/condor | 20 | 12780553 | <filename>condor/particle/particle_map.py
# -----------------------------------------------------------------------------------------------------
# CONDOR
# Simulator for diffractive single-particle imaging experiments with X-ray lasers
# http://xfel.icm.uu.se/condor/
# -------------------------------------------------... | 1.304688 | 1 |
menus.py | Talendar/neuroevolutionary_snake | 11 | 12780554 | <gh_stars>10-100
""" Implements the game's menus.
@author <NAME> (Talendar)
"""
import pygame
import pygame_menu
import tkinter as tk
from tkinter.filedialog import askopenfilename, askdirectory
import config
from snake_game import SnakeGame
from player import HumanPlayer
from evolution.snake_ai import SnakePopulat... | 2.953125 | 3 |
tests/core/test_oauth2/test_rfc7591.py | YPCrumble/authlib | 3,172 | 12780555 | from unittest import TestCase
from authlib.oauth2.rfc7591 import ClientMetadataClaims
from authlib.jose.errors import InvalidClaimError
class ClientMetadataClaimsTest(TestCase):
def test_validate_redirect_uris(self):
claims = ClientMetadataClaims({'redirect_uris': ['foo']}, {})
self.assertRaises(I... | 2.75 | 3 |
src/document/models.py | juliannovoa/SmartScribble | 0 | 12780556 | # Copyright 2020 <NAME>
#
# 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.15625 | 2 |
test6.py | Calen0wong/calen1 | 0 | 12780557 | <gh_stars>0
from PyQt5 import QtCore, QtGui, QtWidgets
class Ui_Form(object):
def setupUi(self, Form):
Form.setObjectName("Form")
Form.resize(653, 483)
self.hxx = QtWidgets.QGraphicsView(Form)
self.hxx.setGeometry(QtCore.QRect(-5, 1, 661, 481))
self.hxx.setObjectName("hxx"... | 2.21875 | 2 |
kabuka/test_kabuka.py | sdanaipat/kabuka | 0 | 12780558 | import os
from pathlib import Path
from unittest import mock
from kabuka import kabuka, get_latest_price
TEST_DATA_DIR = Path(os.path.dirname(os.path.realpath(__file__))) / "test_data"
def test_is_numeric():
assert not kabuka.is_numeric("abc")
assert not kabuka.is_numeric("123a")
assert not kabuka.is_num... | 2.75 | 3 |
server/migrations/versions/f24691273ca4_.py | Rubilmax/netflux | 2 | 12780559 | """empty message
Revision ID: f24691273ca4
Revises: <PASSWORD>
Create Date: 2019-06-18 13:45:46.250079
"""
# revision identifiers, used by Alembic.
revision = 'f24691273ca4'
down_revision = 'b<PASSWORD>'
from alembic import op
import sqlalchemy as sa
def upgrade():
# ### commands auto generated by Alembic - p... | 1.632813 | 2 |
python/examples/gtk_example.py | rambo/arDuBUS | 3 | 12780560 | <gh_stars>1-10
#!/usr/bin/env python
"""This is a very simple arDuBUS example reading one button and controlling PWM of one LED, use the provided YML to generate the Arduino code
1. Copy ardubus.yml.example to examples/ardubus.yml and symlink/copy examples/gtk_example_devices.yml to examples/devices.yml
2. Use bin/cod... | 3.625 | 4 |
Translator/Translator.py | ToastFreak777/Random_Projects | 0 | 12780561 | def translator(phrase):
translated = ""
for letter in phrase:
if letter.lower() in "aeiou":
if letter.isupper():
translated = translated + "G"
else:
translated = translated + "g"
else: # I have just experienced my first indenta... | 3.84375 | 4 |
src/HABApp/util/__init__.py | DerOetzi/HABApp | 0 | 12780562 | <reponame>DerOetzi/HABApp
from . import functions
from .counter_item import CounterItem
from .period_counter import PeriodCounter
from .threshold import Threshold
from .statistics import Statistics
from . import multimode
from .listener_groups import EventListenerGroup
# 27.04.2020 - this can be removed in some time
f... | 1.007813 | 1 |
sutils/slurm_interface/tests/test_resources.py | t-mertz/slurm_utils | 0 | 12780563 | <reponame>t-mertz/slurm_utils<gh_stars>0
import unittest
from unittest.mock import Mock, patch
from .. import resources
from .. import api as slurm
SINFO_STDOUT_TWO_LINE = "node01 partition 0.00 4/0/0/4 1:4:1 idle 8192 8000 0 (null)\n"\
+"node02 partition 0.00 4/0/0/4 1:4:1 idle ... | 2.40625 | 2 |
Compliance_minimization/Figure_6/visualization_2_design_space.py | julianschumann/ae-opt | 0 | 12780564 | import numpy as np
from mpi4py import MPI
from SIMP import TO_SIMP, make_Conn_matrix
def get_void(nely,nelx):
v=np.zeros((nely,nelx))
R=min(nely,nelx)/15
loc=np.array([[1/3, 1/4], [2/3, 1/4],[ 1/3, 1/2], [2/3, 1/2], [1/3 , 3/4], [2/3, 3/4]])
loc=loc*np.array([[nely,nelx]])
for i in range(nely):
... | 1.914063 | 2 |
test/test_triggers.py | PaleNutcrackers/cactbot | 0 | 12780565 | <filename>test/test_triggers.py
"""Tests individual trigger files for the raidboss Cactbot module."""
from pathlib import Path
import subprocess
import sys
from definitions import CactbotModule, DATA_DIRECTORY
def main():
"""Validates individual trigger files within the raidboss Cactbot module.
C... | 2.265625 | 2 |
disgames/mixins/blackjack.py | Jerrydotpy/Disgames | 8 | 12780566 | <filename>disgames/mixins/blackjack.py
import discord
from discord.ext import commands
import random
class BlackJack(commands.Cog):
def __init__(self, bot):
self.bot = bot
def has_lost(self, amt):
if amt == 21:
return False
elif amt > 21:
return True... | 2.65625 | 3 |
solutions/rank-1/cleanup_model/predict.py | mattmotoki/ashrae-great-energy-predictor-3-solution-analysis | 48 | 12780567 | <gh_stars>10-100
#!/usr/bin/env python
# coding: utf-8
import argparse
import matplotlib.pyplot as plt
import seaborn as sns
from sklearn.metrics import mean_squared_error
import pickle
from utils import *
INPUT_DIR = '../input/'
PROCESSED_PATH = "../processed/"
OUTPUT_DIR = '../output/'
MODEL_PATH = '.... | 2.375 | 2 |
crawler.py | nkpydev/SimpleWebCrawler | 0 | 12780568 | import time
from datetime import date
from spydr.spydr import Spydr
from urllib.parse import urlparse
target_url = input("Enter the URL to crawl:\t")
start_time = time.time()
domain_file_name = urlparse(target_url).netloc.replace(".", "_")
result = Spydr().crawl(target_url)
end_time = time.time()
print(f"\n{len(... | 3.25 | 3 |
Chapter7_CNN/Chapter7_3_CNN_Optimization/mnistData.py | thisisjako/UdemyTF | 0 | 12780569 | from typing import Tuple
import numpy as np
from sklearn.model_selection import train_test_split
from tensorflow.keras.datasets import mnist
from tensorflow.keras.preprocessing.image import ImageDataGenerator
from tensorflow.keras.utils import to_categorical
class MNIST:
def __init__(self, with_normali... | 3.109375 | 3 |
resize/forms.py | kelvins/ResizeMe | 1 | 12780570 | <reponame>kelvins/ResizeMe<gh_stars>1-10
from django import forms
class UploadFileForm(forms.Form):
# Image file
file = forms.ImageField()
# Get the width and height fields
width = forms.IntegerField()
height = forms.IntegerField()
# Image formats
CHOICES = [
('jpg','jpg'),
('png','png'),
('bmp','bm... | 2.40625 | 2 |
snake_game.py | SuhasBRao/Snake-game | 0 | 12780571 | <filename>snake_game.py
######################################################################
# Below are the few changes in this file.
#
# I've added a functionaity to keep track of the best score in this py
# file. The score is trakced by using a file named best_score.txt
# The program overwrites this file if the sc... | 3.765625 | 4 |
cyder/tests/all.py | ngokevin/cyder | 1 | 12780572 | from cyder.cydns.tests.all import *
from cyder.cybind.tests import *
| 0.96875 | 1 |
pyPLM/Widgets/LineEdit.py | vtta2008/pipelineTool | 7 | 12780573 | <gh_stars>1-10
# -*- coding: utf-8 -*-
"""
Script Name: Label.py
Author: <NAME>/Jimmy - 3D artist.
Description:
"""
# -------------------------------------------------------------------------------------------------------------
from PySide2.QtWidgets import QLineEdit
from pyPLM.Gui import IntVa... | 2.3125 | 2 |
events_page/remove_subpath_from_gcs.py | los-verdes/lv-event-pagenerator | 0 | 12780574 | #!/usr/bin/env python
from logzero import logger
from apis import storage
if __name__ == "__main__":
import cli
from config import cfg
cfg.load()
parser = cli.build_parser()
args = cli.parse_args(parser)
parser.add_argument(
"-g",
"--gcs-bucket-prefix",
default=cfg.gcs... | 2.25 | 2 |
smart_imports/tests/test_importer.py | Tiendil/smart-imports | 32 | 12780575 |
import os
import math
import json
import uuid
import unittest
import importlib
import subprocess
from unittest import mock
from .. import rules
from .. import config
from .. import helpers
from .. import importer
from .. import constants
from .. import exceptions
from .. import scopes_tree
TEST_FIXTURES_DIR = os.p... | 2.375 | 2 |
tests/conftest.py | EJEmmett/functimer | 1 | 12780576 | from tests.test_timer import mock_timed
| 1.046875 | 1 |
images/program/ultra.py | FikriSatria11/project-skripsi2 | 0 | 12780577 | <filename>images/program/ultra.py
import RPi.GPIO as GPIO
import time
GPIO.setwarnings(False)
#GPIO.setmode(GPIO.BOARD)
def jarakMobil(min, max):
GPIO.setmode(GPIO.BOARD)
TRIG = 11
ECHO = 12
jarakMinimal = min
jarakMaksimal = max
GPIO.setup(TRIG,GPIO.OUT)
GPIO.setup(ECHO,GPIO.IN)... | 3.015625 | 3 |
main.py | Vyvy-vi/gh-twitter-integration | 0 | 12780578 | <reponame>Vyvy-vi/gh-twitter-integration
import os
import tweepy
import logging
logger = logging.getLogger()
def main():
CONSUMER_API_KEY = os.environ["CONSUMER_API_KEY"]
CONSUMER_API_SECRET = os.environ["CONSUMER_API_SECRET"]
ACCESS_TOKEN = os.environ["ACCESS_TOKEN"]
ACCESS_TOKEN_SECRET = os.environ[... | 2.28125 | 2 |
Sorting/Quicksort/quicksort.py | wizh/algorithms | 0 | 12780579 | <filename>Sorting/Quicksort/quicksort.py
def quicksort(seq, low, high):
if low < high:
pivot = partition(seq, low, high)
quicksort(seq, low, pivot)
quicksort(seq, pivot + 1, high)
return seq
def partition(seq, low, high):
pivot = seq[low]
leftwall = low
for i in range(low ... | 3.9375 | 4 |
app_python.py | BernLeWal/raskeytar_webapp | 0 | 12780580 | <reponame>BernLeWal/raskeytar_webapp<filename>app_python.py
#!/usr/bin/python3
#
# The Website of raskeytar.at implemented in Python hosted by Flask.
#
from flask import Flask, send_from_directory
from flask import request
from flask import render_template
webapp = Flask(__name__, template_folder="app_python")... | 2.5 | 2 |
batch/test/test_batch.py | atgenomix/hail | 1 | 12780581 | import os
import time
import re
import unittest
import batch
from flask import Flask, Response, request
import requests
from .serverthread import ServerThread
class Test(unittest.TestCase):
def setUp(self):
self.batch = batch.client.BatchClient(url=os.environ.get('BATCH_URL'))
def test_job(self):
... | 2.5625 | 3 |
cardea/fhir/Specimen.py | sarahmish/Cardea | 69 | 12780582 | <filename>cardea/fhir/Specimen.py
from .fhirbase import fhirbase
class Specimen(fhirbase):
"""
A sample to be used for analysis.
Args:
resourceType: This is a Specimen resource
identifier: Id for specimen.
accessionIdentifier: The identifier assigned by the lab when
ac... | 2.546875 | 3 |
linux/rest/workspace/radoop.py | petergyorgy/virtue | 0 | 12780583 | <reponame>petergyorgy/virtue<gh_stars>0
#from win32com.client import Dispatch
import winshell
from pathlib import Path
import sys, os
import subprocess
import pprint
import base64
from os import listdir
from os.path import isfile, join, isdir
from shutil import rmtree
import pc
import ezfuncs
rdpskel = ""
... | 2.484375 | 2 |
Basic/rockPaper.py | tusharad/python_practice_problems | 0 | 12780584 | # Make a two-player Rock-Paper-Scissors game. (Hint: Ask for player plays (using input),
# compare them, print out a message of congratulations to the winner, and ask if the
# players want to start a new game) Rules:
# Rock beats scissors
# Scissors beats paper
# Paper beats rock
def gameOn():
player1 = int(input... | 3.9375 | 4 |
custom_components/ariston/config_flow.py | fustom/ariston-remotethermo-home-assistant-v3 | 5 | 12780585 | """Config flow for Ariston integration."""
from __future__ import annotations
import logging
import voluptuous as vol
from typing import Any
from homeassistant import config_entries
from homeassistant.const import (
CONF_DEVICE,
CONF_PASSWORD,
CONF_SCAN_INTERVAL,
CONF_USERNAME,
)
from homeassistant.c... | 2.1875 | 2 |
src/backend/libro/obtener/app.py | gpeitzner/SA_EZREAD | 0 | 12780586 | <reponame>gpeitzner/SA_EZREAD<filename>src/backend/libro/obtener/app.py
from flask import Flask, request
import os
import json
import pymongo
from bson.objectid import ObjectId
from bson.json_util import dumps
from flask_cors import CORS
app = Flask(__name__)
CORS(app)
db_host = os.environ["db_host"] if "db_host" in ... | 2.125 | 2 |
tilezilla/cli/main.py | ceholden/landsat_tiles | 5 | 12780587 | import logging
from pkg_resources import iter_entry_points
import click
import click_plugins
from . import options
from .. import __version__
_context = dict(
token_normalize_func=lambda x: x.lower(),
help_option_names=['--help', '-h'],
auto_envvar_prefix='TILEZILLA'
)
LOG_FORMAT = '%(asctime)s:%(leveln... | 2.015625 | 2 |
twixtools/map_twix.py | mrphysics-bonn/twixtools | 25 | 12780588 | <reponame>mrphysics-bonn/twixtools<gh_stars>10-100
import copy
import numpy as np
import twixtools
from twixtools.recon_helpers import (
remove_oversampling, calc_regrid_traj, perform_regrid
)
# define categories in which the twix data should be sorted based on MDH flags
# that must or must not be set (True/False... | 1.828125 | 2 |
recohut/datasets/retailrocket.py | sparsh-ai/recohut | 0 | 12780589 | # AUTOGENERATED! DO NOT EDIT! File to edit: nbs/datasets/datasets.retailrocket.ipynb (unless otherwise specified).
__all__ = ['RetailRocketDataset', 'RetailRocketDatasetv2']
# Cell
from typing import List, Optional, Callable, Union, Any, Tuple
import os
import os.path as osp
from collections.abc import Sequence
impo... | 2.3125 | 2 |
omni_reports/facebook_reports/base.py | paretogroup/omni-reports | 24 | 12780590 | <filename>omni_reports/facebook_reports/base.py
import json
from typing import Dict, List
from aiohttp import ClientSession
from omni_reports.client import ReportClient
from omni_reports.client.errors import ReportResponseError
from omni_reports.client.models import ReportPredicate, ReportDefinitionDateRange
from omn... | 2.046875 | 2 |
PythonExercicios/ex009.py | marcoantonio97/Curso-de-Python | 0 | 12780591 | <reponame>marcoantonio97/Curso-de-Python<gh_stars>0
n = int(input('Digite um número: '))
print('{}x1={}'.format(n, (n*1)))
print('{}x2={}'.format(n, (n*2)))
print('{}x3={}'.format(n, (n*3)))
print('{}x4={}'.format(n, (n*4)))
print('{}x5={}'.format(n, (n*5)))
print('{}x6={}'.format(n, (n*6)))
print('{}x7={}'.format(n, (... | 4.03125 | 4 |
Python/_03_Strings/_13_The_Minion_Game/solution.py | avtomato/HackerRank | 0 | 12780592 | def minion_game(string):
# your code goes here
a = s.strip().lower()
v = sum([len(a) - i for i,c in enumerate(a) if c in 'aeiou'])
c = sum([len(a) - i for i,c in enumerate(a) if c not in 'aeiou'])
if (v == c):
print('Draw')
else:
print('Stuart {}'.format(c)) if c > v else print(... | 3.53125 | 4 |
demo/onlyuserrole/demo/views.py | tangdyy/onlyuserclient | 2 | 12780593 | <reponame>tangdyy/onlyuserclient<gh_stars>1-10
from onlyuserclient.viewsets import RoleModelViewSet
from .serializers import DefaultDemoSerializer, CompleteDemoSerializer, HideDemoSerializer
from .models import RoleDemo
class RoleViewSet(RoleModelViewSet):
queryset = RoleDemo.objects.all()
user_relate_field = ... | 1.914063 | 2 |
CS362_TESTS/jacobsonUnitTest2.py | IsaacMarquez907/CS361_GROUP_PROJECT | 1 | 12780594 | <reponame>IsaacMarquez907/CS361_GROUP_PROJECT
#!/usr/bin/env python
# coding: utf-8
# import necessary libraries
import os
import sys
import unittest
#allow the script to be run directly
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
#import function to test
from youtube_dl.utils impo... | 3.21875 | 3 |
STEP 2: INPUT ANALYSIS/rd_parser.py | amalshehu/super-slang | 0 | 12780595 | <reponame>amalshehu/super-slang
from abstract_syntax_tree import Operator
from abstract_syntax_tree import Expression
from abstract_syntax_tree import NumericConstant
from abstract_syntax_tree import BinaryExpression
from abstract_syntax_tree import UnaryExpression
from lexer import Lexer
from lexer import Token
| 1.09375 | 1 |
private_training/src/models.py | xiyueyiwan/private-ml-for-health | 28 | 12780596 | <gh_stars>10-100
import torch
from torch import nn
import torch.nn.functional as F
class CNNMnistRelu(nn.Module):
def __init__(self):
super().__init__()
self.conv1 = nn.Conv2d(1, 16, 8, 2, padding=3)
self.conv2 = nn.Conv2d(16, 32, 4, 2)
self.fc1 = nn.Linear(32 * 4 * 4, 32)
s... | 2.84375 | 3 |
intro/part01-25_calculator/test/test_calculator.py | Hannah-Abi/python-pro-21 | 0 | 12780597 | import unittest
from unittest.mock import patch
from tmc import points
from tmc.utils import load_module, reload_module, get_stdout, sanitize
exercise = 'src.calculator'
def parse_result(output):
if len(output) > 30:
return output[:30] + "..."
else:
return output
#add, multiply,subtract(-)
@p... | 3.171875 | 3 |
solarpv/deployment/pipeline.py | shivareddyiirs/solar-pv-global-inventory | 64 | 12780598 | """
Run the pipeline
"""
# built-in
import os, sys, logging, datetime, json
# packages
import yaml
import descarteslabs as dl
import shapely.geometry as geometry
# lib
from deployment.cloud_dl_functions import DL_CLOUD_FUNCTIONS
# conf
logging.basicConfig(stream=sys.stdout, level=logging.INFO)
def reduce2mp(polys,... | 2.375 | 2 |
util/misc.py | AlonFischer/SpatialDatabaseBench | 1 | 12780599 | <filename>util/misc.py
import decimal
def convert_decimals_to_ints_in_tuples(data):
"""data is an array of tuples"""
modified_data = []
for t in data:
new_t = t
for idx in range(len(new_t)):
if isinstance(t[idx], decimal.Decimal):
new_t = new_t[0:idx] + (int(new... | 3.78125 | 4 |
lib/bridgedb/test/test_schedule.py | pagea/bridgedb | 0 | 12780600 | <reponame>pagea/bridgedb<filename>lib/bridgedb/test/test_schedule.py
# -*- coding: utf-8 -*-
#
# This file is part of BridgeDB, a Tor bridge distribution system.
#
# :authors: <NAME> 0xA3ADB67A2CDB8B35 <<EMAIL>>
# :copyright: (c) 2014, Isis Lovecruft
# (c) 2014, The Tor Project, Inc.
# :license: see LICENSE... | 2.296875 | 2 |
inventory/admin.py | brkyavuz/pfna | 0 | 12780601 | from django.contrib import admin
from inventory.models import Group, Host, Data
# Register your models here.
admin.site.register(Host)
admin.site.register(Group)
admin.site.register(Data) | 1.476563 | 1 |
alipay/aop/api/response/AlipayBossFncGffundStandardvoucherBatchqueryResponse.py | antopen/alipay-sdk-python-all | 0 | 12780602 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
from alipay.aop.api.response.AlipayResponse import AlipayResponse
from alipay.aop.api.domain.StandardVoucherOpenApiVO import StandardVoucherOpenApiVO
class AlipayBossFncGffundStandardvoucherBatchqueryResponse(AlipayResponse):
def __init__(self):
... | 1.960938 | 2 |
pandaexcel.py | cenchaojun/pytorch-image-models | 0 | 12780603 | import pandas as pd
def deal():
# 列表
company_name_list = ['12312', '141', '515', '41']
# list转dataframe
df = pd.DataFrame(company_name_list)
# 保存到本地excel
df.to_csv("company_name_li.csv", index=False)
if __name__ == '__main__':
deal()
| 2.765625 | 3 |
setup.py | equinor/webviz-dev-sync | 0 | 12780604 | import os
import re
import pathlib
from setuptools import setup, find_packages
def get_long_description() -> str:
"""Converts relative repository links to absolute URLs
if GITHUB_REPOSITORY and GITHUB_SHA environment variables exist.
If not, it returns the raw content in README.md.
"""
raw_readm... | 1.960938 | 2 |
models/base_model.py | xuyouze/DropNet | 1 | 12780605 | # coding:utf-8
# @Time : 2019/5/15
# @Author : xuyouze
# @File Name : base_model.py
import importlib
import os
from abc import ABC, abstractmethod
from collections import OrderedDict
import torch
from torch import nn
from config.base_config import BaseConfig
from networks import *
class BaseModel(... | 2.5 | 2 |
rendering.py | NChechulin/telegram-renderer-bot | 1 | 12780606 | """This module contains functions for converting LaTeX and Markdown files"""
import string
import random
import os
import multiprocessing
import time
from markdown import markdown
import pdfkit
MAX_WAIT_TIME = 3
POLLING_RATE = 10
def try_create_tempdir():
os.makedirs(os.getcwd() + "/TEMP", exist_ok=True)
def... | 2.90625 | 3 |
authz/controller/apiv1/__init__.py | nimatbt/Auth-Microservice | 0 | 12780607 | from authz.controller.apiv1.user import UserController
from authz.controller.apiv1.auth import AuthController # 20-1 : 52'
| 1.21875 | 1 |
python/challenges/datastructures/arrays-left-rotation.py | KoderDojo/hackerrank | 1 | 12780608 | """
Given an array of integers and a number, n, perform d left rotations
on the array. Then print the updated array as a single line of
space-separated integers.
"""
_, d = map(int, input().strip().split(' '))
arr = input().strip().split(' ')
shifted_arr = arr[d:] + arr[0:d]
print(' '.join(shifted_arr))
| 3.71875 | 4 |
gendoc.py | Francesco149/jniproxy | 23 | 12780609 | #!/usr/bin/env python
import sys
print_lines = False
with open("jniproxy.c", "r") as f:
for line in f:
if line.strip().endswith("*/"):
sys.exit(0);
if print_lines:
print(line[4:-1])
elif line.strip().startswith("/*"):
print_lines = True
| 2.546875 | 3 |
tests/backend_test.py | onebitaway/khal | 0 | 12780610 | <filename>tests/backend_test.py
import pytest
import pytz
from datetime import date, datetime, timedelta, time
import icalendar
from khal.khalendar import backend
from khal.khalendar.event import LocalizedEvent
from khal.khalendar.exceptions import OutdatedDbVersionError, UpdateFailed
from .aux import _get_text
BE... | 2.078125 | 2 |
py/cidoc_crm_types/properties/p74i_is_current_or_former_residence_of.py | minorg/cidoc-crm-types | 0 | 12780611 | from dataclasses import dataclass
@dataclass
class P74iIsCurrentOrFormerResidenceOf:
URI = "http://erlangen-crm.org/current/P74i_is_current_or_former_residence_of"
| 1.820313 | 2 |
integration/tests_failed/assert_invalid_predicate_type.py | jleverenz/hurl | 0 | 12780612 | <reponame>jleverenz/hurl
from app import app
@app.route("/error-assert-invalid-predicate-type")
def error_assert_invalid_predicate_type():
return ""
| 1.882813 | 2 |
examples/applications/run_multi_functions.py | JokerHB/mealpy | 1 | 12780613 | #!/usr/bin/env python
# ------------------------------------------------------------------------------------------------------%
# Created by "Thieu" at 17:40, 06/11/2021 %
# ... | 2.71875 | 3 |
crab/plugins/tools/rigging/joints/singulization.py | Mikfr83/crab | 0 | 12780614 | <reponame>Mikfr83/crab<gh_stars>0
import crab
import pymel.core as pm
# ------------------------------------------------------------------------------
class SingulizeSelected(crab.RigTool):
identifier = 'joints_singulize_selected'
display_name = 'Singulize Selected'
icon = 'joints.png'
# -----------... | 2.25 | 2 |
monoensemble/version.py | vasselai/monoensemble | 5 | 12780615 | <reponame>vasselai/monoensemble
from __future__ import absolute_import, division, print_function
from os.path import join as pjoin
# Format expected by setup.py and doc/source/conf.py: string of form "X.Y.Z"
_version_major = 1
_version_minor = 3
_version_micro = 2 # use '' for first of series, number for 1 and above
... | 1.453125 | 1 |
examples/heat_example_base/options.py | melissa-sa/melissa | 7 | 12780616 | <gh_stars>1-10
###################################################################
# Melissa #
#-----------------------------------------------------------------#
# COPYRIGHT (C) 2017 by INRIA and EDF. ALL RIGHTS RESERVED. #
# ... | 2.28125 | 2 |
boilerplate/setup.py | MTrajK/python-projects | 5 | 12780617 | <filename>boilerplate/setup.py
from setuptools import setup, find_packages
setup(
name='boilerplate',
version='0.0.1',
description='Python project boilerplate.',
author='<NAME>',
python_requires='>=3',
install_requires=[],
# If you have only one package then use: packages=['boilerplate']
... | 1.664063 | 2 |
app/WebSensorGatherer.py | ncalligaro/GardenCity | 0 | 12780618 | #!/usr/bin/python
from config import config
import commonFunctions
import datetime
import traceback
import httplib
import json
import sys
import logging
from time import sleep
logging.basicConfig(level=config.get_logging_level(),
format=config.runtime_variables['log_format'],
... | 2.59375 | 3 |
perfplot/__about__.py | pardha-bandaru/perfplot | 1 | 12780619 | # -*- coding: utf-8 -*-
#
__author__ = u"<NAME>"
__author_email__ = "<EMAIL>"
__copyright__ = u"Copyright (c) 2017-2018, {} <{}>".format(__author__, __author_email__)
__license__ = "License :: OSI Approved :: MIT License"
__version__ = "0.5.0"
__status__ = "Development Status :: 5 - Production/Stable"
| 1.25 | 1 |
training_model.py | puneesh00/cs-mri-gan | 21 | 12780620 | from keras.utils import multi_gpu_model
import numpy as np
import tensorflow as tf
import pickle
from keras.models import Model, Input
from keras.optimizers import Adam, RMSprop
from keras.layers import Dense
from keras.layers import Conv2D, Conv2DTranspose
from keras.layers import Flatten, Add
from keras.layers impor... | 2.09375 | 2 |
text_normalizer/library/strip.py | Yoctol/text-normalizer | 16 | 12780621 | from ..factory import Strip
pure_strip_text_normalizer = Strip()
| 1.195313 | 1 |
deprecated/water_rgb.py | alex-ip/agdc | 34 | 12780622 | <reponame>alex-ip/agdc
#!/usr/bin/env python
#===============================================================================
# Copyright (c) 2014 Geoscience Australia
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the ... | 1.390625 | 1 |
print_result/print_result.py | Josepholaidepetro/maven_kubeflow_pipeline | 0 | 12780623 |
import argparse
def print_result(args):
# Print results
with open(args.accuracy, 'r') as f:
score = f.read()
print(f"Random forest (accuracy): {score}")
if __name__ == '__main__':
# Defining and parsing the command-line arguments
parser = argparse.ArgumentParser(description='My prog... | 2.984375 | 3 |
Project_Files/source/simprocedure/wcslen.py | SoftwareSecurityLab/Heap-Overflow-Detection | 0 | 12780624 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Sat Feb 13 22:07:00 2021
@authors: <NAME>
<NAME>
<NAME>
"""
import angr
class wcslen(angr.SimProcedure):
def run(self, s):
print('in wcslen')
f=angr.SIM_PROCEDURES['libc']['strlen']
self.state.globals['iswchar']=Tr... | 2.28125 | 2 |
backprop/models/st_model/model.py | lucky7323/backprop | 200 | 12780625 | from typing import Dict, List
import torch
from functools import partial
from backprop.models import PathModel
from torch.optim.adamw import AdamW
from sentence_transformers import SentenceTransformer
class STModel(PathModel):
"""
Class for models which are initialised from Sentence Transformers
Attribut... | 2.671875 | 3 |
tokenizer/java/java_tokenizer.py | Guardian99/NeuralCodeSummarization | 0 | 12780626 | from c2nl.tokenizers.code_tokenizer import CodeTokenizer, Tokens, Tokenizer
import argparse
import re
from os import path
import javalang
from pathlib import Path
def get_project_root() -> Path:
"""Returns project root folder."""
return str(Path(__file__).parent.parent.parent)
def get_java_method_map(tree):... | 2.6875 | 3 |
table_border_syntax.py | akrabat/SublimeTableEditor | 313 | 12780627 | <gh_stars>100-1000
# table_border_syntax.py - Base classes for table with borders: Pandoc,
# Emacs Org mode, Simple, reStrucutredText
# Copyright (C) 2012 Free Software Foundation, Inc.
# Author: <NAME>
# Package: SublimeTableEditor
# Homepage: https://github.com/vkocubinsky/SublimeTableEditor
# This file is part o... | 2.65625 | 3 |
apps/places/urls.py | bergran/places | 0 | 12780628 | # -*- coding: utf-8 -*-
from fastapi.routing import APIRouter
from apps.places.views import places
router = APIRouter()
router.include_router(places.router, prefix='/places')
| 1.84375 | 2 |
ansys/mapdl/core/_commands/misc/__init__.py | da1910/pymapdl | 0 | 12780629 | from .misc import verify
| 1.054688 | 1 |
Day5/python problems/reverse_string.py | abbeyperini/DC_HTML_CSS | 0 | 12780630 | '''
Reverse string
Reverse string, in linear time complexity.
Input: 'i like this program very much'
Output: 'hcum yrev margorp siht ekil i'
Input: 'how are you'
Output: 'uoy era woh'
'''
'''
Finish the function
'''
def reverse_sentence(sentence):
reverse = []
for i in range((len(sentence) - 1), -1, -1):
... | 4 | 4 |
tests/test_date_serialisation.py | thehyve/transmart_loader | 3 | 12780631 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Tests for the date formatter of the TransmartCopyWriter.
"""
from datetime import datetime, timezone, date
from dateutil.tz import gettz
from transmart_loader.copy_writer import format_date, microseconds
def test_date_serialization():
assert format_date(
d... | 2.609375 | 3 |
code/result_reranker.py | leifos/retrievability | 0 | 12780632 | <reponame>leifos/retrievability
# AUTHOR: <NAME>
# 12-02-2022
# Reranking result runs using retrievability scores
import os
import argparse
def check_file_exists(filename):
if filename and not os.path.exists(filename):
print("{0} Not Found".format(filename))
quit(1)
def read_ret_file(ret_file):... | 3.140625 | 3 |
aiogram_dialog_extras/models/__init__.py | SamWarden/aiogram_dialog_extras | 1 | 12780633 | <gh_stars>1-10
from .text import PositionalVM
| 1.007813 | 1 |
toqito/matrices/iden.py | paniash/toqito | 76 | 12780634 | """Identity matrix."""
from scipy import sparse
import numpy as np
def iden(dim: int, is_sparse: bool = False) -> np.ndarray:
r"""
Calculate the :code:`dim`-by-:code:`dim` identity matrix [WIKID]_.
Returns the :code:`dim`-by-:code:`dim` identity matrix. If :code:`is_sparse
= False` then the matrix w... | 4.09375 | 4 |
MayaPythonPlugin/pyHelloMaya.py | WendyAndAndy/MayaDev | 19 | 12780635 | # coding:utf-8
# 一个简单的Maya Python插件 By Jason (<EMAIL>), 公众号: WendyAndAndy
import sys
from maya.api import OpenMaya as om
def maya_useNewAPI():
pass
__VENDOR = '<EMAIL> | <EMAIL> | iJasonLee@WeChat'
__VERSION= '2018.08.08.01'
class HelloMaya(om.MPxCommand):
command = 'pyHello'
def __init__(self):
... | 2.53125 | 3 |
zwog/utils.py | tare/zwog | 2 | 12780636 | """Routines for processing workouts."""
from typing import Union, Tuple, Optional
from xml.etree.ElementTree import (ElementTree, Element,
SubElement, tostring)
from lark import Lark
from lark import Transformer
class WorkoutTransformer(Transformer):
"""Class to process workout... | 3.078125 | 3 |
packages/syft/src/syft/core/tensor/autodp/row_entity_phi.py | pculliton/PySyft | 2 | 12780637 | <reponame>pculliton/PySyft
# future
from __future__ import annotations
# stdlib
from collections.abc import Sequence
from typing import Any
from typing import List
from typing import Optional
from typing import Tuple
from typing import Union
# third party
import numpy as np
import numpy.typing as npt
# relative
from... | 1.914063 | 2 |
strar/errors.py | martvanrijthoven/strar | 0 | 12780638 | from dataclasses import dataclass
from typing import Optional
@dataclass(frozen=True)
class RegistrantNotRegisteredError(Exception):
"""Raised when registrant name does not exist in the register"""
cls: type
registrant_name: str
register: Optional[dict]
def __post_init__(self):
super()._... | 3.234375 | 3 |
samples/use_market_hours.py | areed1192/td-ameritrade-api | 40 | 12780639 | <filename>samples/use_market_hours.py
from pprint import pprint
from datetime import datetime
from configparser import ConfigParser
from td.credentials import TdCredentials
from td.client import TdAmeritradeClient
from td.utils.enums import Markets
# Initialize the Parser.
config = ConfigParser()
# Read the file.
con... | 2.625 | 3 |
avista_sensors/impl/vibration_processor.py | ommmid/sensors | 0 | 12780640 | <gh_stars>0
import time
from avista_sensors.sensor_processor import SensorProcessor
from mpu6050 import mpu6050
import numpy.fft as nfft
import numpy as np
class VibrationProcessor(SensorProcessor):
"""MPU6050 sensor implementation (Accelerometer and Vibration)
Attributes:
**_address (int)**: I2C add... | 3.171875 | 3 |
pru/SphereTurnArc.py | euctrl-pru/rt-python | 0 | 12780641 | <gh_stars>0
# Copyright (c) 2018 Via Technology Ltd. All Rights Reserved.
# Consult your license regarding permissions and restrictions.
"""
This module supports turning arcs in Spherical Vector coordinates.
"""
import numpy as np
from via_sphere import distance_radians, Arc3d
MIN_TURN_ANGLE = np.deg2rad(1.0)
""" The... | 3.109375 | 3 |
src/ModelEvaluation/roc.py | FDUJiaG/PyML-Course | 1 | 12780642 | <reponame>FDUJiaG/PyML-Course
import numpy as np
import matplotlib.pyplot as plt
from mglearn.datasets import make_blobs
from sklearn.datasets import load_digits
from sklearn.model_selection import train_test_split
from sklearn.svm import SVC
from sklearn.ensemble import RandomForestClassifier
from sklearn.metrics impo... | 2.359375 | 2 |
cursor.py | avysk/psgo_emitter | 2 | 12780643 | <filename>cursor.py
"""Cursor on the board."""
class Cursor():
"""Entity that stores a cursor."""
def __init__(self):
self._point = [0, 0]
@property
def point(self):
"""Return cursor position."""
return tuple(self._point)
def _change(self, axis, delta):
self._poin... | 3.5625 | 4 |
skmob/preprocessing/clustering.py | LLucchini/scikit-mobility | 0 | 12780644 | <gh_stars>0
from ..utils import utils, constants
from ..core.trajectorydataframe import *
from sklearn.cluster import DBSCAN
import numpy as np
import inspect
kms_per_radian = 6371.0088 # Caution: this is only true at the Equator!
# This may cause problems at high latitudes.
def cluste... | 2.71875 | 3 |
base.py | vicenteneto/online-judge-solutions | 0 | 12780645 | <reponame>vicenteneto/online-judge-solutions
# -*- coding: utf-8 -*-
'''
Escreva a sua solução aqui
Code your solution here
Escriba su solución aquí
'''
| 1.15625 | 1 |
runtime/python/Lib/asyncio/format_helpers.py | hwaipy/InteractionFreeNode | 207 | 12780646 | <filename>runtime/python/Lib/asyncio/format_helpers.py<gh_stars>100-1000
import functools
import inspect
import reprlib
import sys
import traceback
from . import constants
def _get_function_source(func):
func = inspect.unwrap(func)
if inspect.isfunction(func):
code = func.__code__
... | 2.59375 | 3 |
bazel/aprutil.bzl | arunvc/incubator-pagespeed-mod | 535 | 12780647 | aprutil_build_rule = """
cc_library(
name = "aprutil",
srcs = [
"@mod_pagespeed//third_party/aprutil:aprutil_pagespeed_memcache_c",
'buckets/apr_brigade.c',
'buckets/apr_buckets.c',
'buckets/apr_buckets_alloc.c',
'buckets/apr_buckets_eos.c',
'buckets/apr_buckets_... | 1.148438 | 1 |
project_optimizing_public_transportation/consumers/clean_schema.py | seoruosa/streaming-data-nanodegree | 0 | 12780648 | import requests
SCHEMA_REGISTRY = "http://localhost:8081"
def subjects():
resp = requests.get(
f"{SCHEMA_REGISTRY}/subjects",
headers={"Content-Type": "application/json"}
)
resp.raise_for_status()
return resp.json()
# curl -X DELETE http://localhost:8081/subjects/com.u... | 2.65625 | 3 |
WebBrickGateway/WebBrickGateway/panels/widgets/NumericDisplay.py | AndyThirtover/wb_gateway | 0 | 12780649 | # Copyright L.P.Klyne 2013
# Licenced under 3 clause BSD licence
# $Id: NumericDisplay.py 2696 2008-09-05 09:33:43Z graham.klyne $
#
# Widget class for simple button on a form
#
from urlparse import urljoin
from turbogears.widgets.base import Widget, CompoundWidget, WidgetsList
from turbogears.widgets.forms impor... | 2.171875 | 2 |
evaluation/nmi.py | kikaitech/classification_metric_learning | 93 | 12780650 | import faiss
import numpy as np
from sklearn.cluster import KMeans
from sklearn.metrics.cluster import normalized_mutual_info_score
from argparse import ArgumentParser
def parse_args():
"""
Helper function parsing the command line options
@retval ArgumentParser
"""
parser = ArgumentParser(descrip... | 2.484375 | 2 |