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 |
|---|---|---|---|---|---|---|
blargh/engine/storage/pg/pg_storage.py | johny-b/blargh | 0 | 12799451 | <reponame>johny-b/blargh
'''
CURRENT ASSUMPTIONS:
* all tables are in a single schema
* tables have the same names as resources
'''
from ..base_storage import BaseStorage
from blargh.engine import dm
from .query import Query
from .... import exceptions
import psycopg2
def capture_psycopg_error(f):
de... | 1.921875 | 2 |
python-algorithm/leetcode/problem_981.py | isudox/nerd-algorithm | 5 | 12799452 | """981. Time Based Key-Value Store
https://leetcode.com/problems/time-based-key-value-store/
Create a timebased key-value store class TimeMap, that supports two operations.
1. set(string key, string value, int timestamp)
Stores the key and value, along with the given timestamp.
2. get(string key, int timestamp)
Ret... | 3.6875 | 4 |
chronologer/vega.py | dandavison/chronologer | 165 | 12799453 | import json
import os
from jinja2 import Template
from chronologer.config import config
def write_html():
html_file = os.path.join(os.path.dirname(__file__), "templates", "index.html")
with open(html_file) as fp:
html_template = Template(fp.read())
if not config.dry_run:
boxplot_spec = j... | 2.375 | 2 |
pyaaf/__init__.py | markreidvfx/pyaaf_old | 2 | 12799454 | from core import *
import core
def Initialize():
"""
find libcom-api and initialize
"""
import os
import sys
dirname = os.path.dirname(__file__)
ext = '.so'
if sys.platform == 'darwin':
ext = '.dylib'
elif sys.platform.startswith("win"):
ext = '.dll'
... | 2.25 | 2 |
utils/yaml_utils.py | TestOpsFeng/selenium_framework | 7 | 12799455 | import yaml
import os
fileNamePath = os.path.split(os.path.realpath(__file__))[0]
dir = os.path.join(fileNamePath,'../conf')
def get(file_name,*keys,file_path=dir):
yamlPath = os.path.join(file_path, file_name)
file = open(yamlPath, 'r', encoding='utf-8')
config = yaml.load(file)
for key in keys:
... | 2.625 | 3 |
checkov/terraform/checks/resource/oci/IAMPasswordLength.py | jamesholland-uk/checkov | 1 | 12799456 | <reponame>jamesholland-uk/checkov
from checkov.common.models.enums import CheckCategories, CheckResult
from checkov.terraform.checks.resource.base_resource_check import BaseResourceCheck
class IAMPasswordLength(BaseResourceCheck):
def __init__(self):
name = "OCI IAM password policy for local (non-federate... | 2.25 | 2 |
run.py | ilyavinn/geppetto | 4 | 12799457 | <reponame>ilyavinn/geppetto
"""
The MIT License (MIT)
Copyright (c) <NAME>, Inc. 2015.
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 ... | 2.015625 | 2 |
test/test_expansion.py | zachjweiner/pystella | 14 | 12799458 | __copyright__ = "Copyright (C) 2019 <NAME>"
__license__ = """
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, modif... | 1.726563 | 2 |
mergify_engine/tests/unit/test_subscription.py | Divine-D/mergify-engine | 1 | 12799459 | import pytest
from mergify_engine import subscription
def test_init():
subscription.Subscription(
123, True, "friend", {}, frozenset({subscription.Features.PRIVATE_REPOSITORY})
)
def test_dict():
owner_id = 1234
sub = subscription.Subscription(
owner_id,
True,
"frien... | 2.046875 | 2 |
src/ingest-pipeline/airflow/plugins/hubmap_api/__init__.py | AustinHartman/ingest-pipeline | 6 | 12799460 | from airflow.plugins_manager import AirflowPlugin
from hubmap_api.manager import aav1 as hubmap_api_admin_v1
from hubmap_api.manager import aav2 as hubmap_api_admin_v2
from hubmap_api.manager import aav3 as hubmap_api_admin_v3
from hubmap_api.manager import aav4 as hubmap_api_admin_v4
from hubmap_api.manager import aa... | 1.460938 | 1 |
giggleliu/tba/hgen/setup.py | Lynn-015/Test_01 | 2 | 12799461 | '''
Setup file for Operator and Hamiltonain Generators.
'''
def configuration(parent_package='',top_path=None):
from numpy.distutils.misc_util import Configuration
config=Configuration('hgen',parent_package,top_path)
return config
if __name__ == '__main__':
from numpy.distutils.core import setup
se... | 1.40625 | 1 |
hoodapp/migrations/0014_auto_20220110_1119.py | lizgi/Hood-Watch | 0 | 12799462 | # Generated by Django 3.2.9 on 2022-01-10 08:19
import cloudinary.models
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('hoodapp', '0013_auto_20220110_1102'),
]
operations = [
migrations.AlterModelOptions(
name='post',
o... | 1.789063 | 2 |
src/googleapis/codegen/filesys/package_writer_foundry.py | aiuto/google-apis-client-generator | 178 | 12799463 | <reponame>aiuto/google-apis-client-generator
#!/usr/bin/python2.7
"""Foundary for getting a package writer."""
from googleapis.codegen.filesys import filesystem_library_package
from googleapis.codegen.filesys import single_file_library_package
from googleapis.codegen.filesys import tar_library_package
from googleapis.... | 2.296875 | 2 |
PYTHON/generateQRcode.py | kunalmpandey/open-source-contribution | 2 | 12799464 | <gh_stars>1-10
# Import QRCode from pyqrcode
import pyqrcode
import png
from pyqrcode import QRCode
print("WELCOME TO THE QR CODE GENERATION")
# Take input
name = input("Enter Name : ")
stream = input("Enter Stream : ")
collegename = input("Enter Name of College : ")
# String which represents the QR code
s = "Name... | 3.296875 | 3 |
utils/files_chain.py | syth0le/mat_mod_labs | 0 | 12799465 | from abc import ABCMeta, abstractmethod
from typing import Optional
import json
def error_catcher(method):
def wrapper(*args, **kwargs):
try:
return method(*args, **kwargs)
except (AttributeError, ValueError):
return "File error: указан неверный тип файла."
return wrapp... | 3.25 | 3 |
benchmarks/toolkit/methods/utils.py | SergioRAgostinho/cvxpnpl | 51 | 12799466 | <filename>benchmarks/toolkit/methods/utils.py
from importlib import import_module
import numpy as np
# Dynamically import matlab
_matlab = None
_matlab_engine = None
try:
_matlab = import_module("matlab")
_matlab.engine = import_module("matlab.engine")
except ModuleNotFoundError:
pass
def init_matlab():... | 2.390625 | 2 |
ex5.py | ppedraum/infosatc-lp-avaliativo-02 | 0 | 12799467 | <reponame>ppedraum/infosatc-lp-avaliativo-02
#5
lista = ["laranja", "banana", "maçã", "goiaba", "romã"]
if "laranja" in lista:
print("Laranja está na lista.")
else:
print("Laranja não está na lista")
| 3.6875 | 4 |
examples/amac/__init__.py | acracker/ruia | 0 | 12799468 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Time : 2019-01-17 13:48
# @Author : pang
# @File : __init__.py.py
# @Software: PyCharm
| 1.164063 | 1 |
garage/envs/dm_control/dm_control_viewer.py | shadiakiki1986/garage | 3 | 12799469 | <reponame>shadiakiki1986/garage<gh_stars>1-10
import numpy as np
import pygame
CAPTION = "dm_control viewer"
class DmControlViewer:
def __init__(self):
pygame.init()
pygame.display.set_caption(CAPTION)
self.screen = None
def loop_once(self, image):
image = np.swapaxes(image, ... | 2.84375 | 3 |
topboard_sdk/api/topboard/update_comment_pb2.py | easyopsapis/easyops-api-python | 5 | 12799470 | # -*- coding: utf-8 -*-
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: update_comment.proto
import sys
_b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1'))
from google.protobuf import descriptor as _descriptor
from google.protobuf import message as _message
from google.proto... | 1.21875 | 1 |
setup.py | AZdet/causal-infogan | 0 | 12799471 | from setuptools import setup
import numpy
setup(
name='CIGAN',
version='0.2dev',
packages=['vpa'],
license='MIT License',
include_dirs=[numpy.get_include(),],
) | 1.132813 | 1 |
apps/CUP3D_LES_HIT/computeTrainedSpectraErrors.py | slitvinov/smarties | 0 | 12799472 | #!/usr/bin/env python3
import re, argparse, numpy as np, glob, os
#from sklearn.neighbors.kde import KernelDensity
import matplotlib.pyplot as plt
from extractTargetFilesNonDim import epsNuFromRe
from extractTargetFilesNonDim import getAllData
from computeSpectraNonDim import readAllSpectra
colors = ['#1f78b4', '#3... | 1.953125 | 2 |
python/lastfactorialdigit.py | twirrim/kattis | 0 | 12799473 | #!/usr/bin/env python3
""" An attempt to solve the Last Factorial Digit """
import sys
# This is totally wrong, but given N maxes out at 10, and anything after 5 the last digit is 0,
# this is likely cheaper and faster
result_dict = {1: 1,
2: 2,
3: 6,
4: 4}
dont_care = sy... | 3.4375 | 3 |
ptptest/pytz.py | chrisy/ptptest | 3 | 12799474 | # vim: tabstop=4 expandtab shiftwidth=4 softtabstop=4
#
# Copyright (c) 2014 <NAME> <<EMAIL>>
#
"""Pytz dummy module"""
# This empty module with the name pytz.py fools
# bson.py into loading; we then provide the only
# pytz-reference used by bson - 'utc'
from datetime import datetime
from datetime import tzinfo
c... | 2.359375 | 2 |
apps/execution_node_editor/main.py | beyse/NodeEditor | 3 | 12799475 | import os, sys
from PyQt5 import QtCore, QtGui
from qtpy.QtWidgets import QApplication
import ctypes
from sys import platform
sys.path.insert(0, os.path.join( os.path.dirname(__file__), "..", ".." ))
from window import ExecutionNodeEditorWindow
if __name__ == '__main__':
app = QApplication(sys.argv)
exe_p... | 2.1875 | 2 |
pyunsplash/tests/test_users.py | mmangione/pyunsplash | 40 | 12799476 | <filename>pyunsplash/tests/test_users.py
###############################################################################
# Copyright (c) 2016 <NAME> <<EMAIL>>
#
# File: test_users.py
#
# Author: <NAME> <<EMAIL>>
# Date: 14 Dec 2016
# Purpose: users unit tests
#
# Revision: 1
# Comment: What's new i... | 2.15625 | 2 |
ex097.py | honeyhugh/PythonCurso | 0 | 12799477 | <gh_stars>0
from math import trunc
def escreva(msg):
c = trunc(len(msg)/2)
print(f'{"-=":^}' * (c + 2))
print(f' {msg}')
print(f'{"-=":^}' * (c + 2))
# Programa Principal
n = input('Escreva uma mensagem: ')
escreva(n)
| 3.171875 | 3 |
app.py | yaniv-aknin/multiviz | 0 | 12799478 | <gh_stars>0
#!/usr/bin/env python
import subprocess
from flask import Flask, request
app = Flask(__name__)
class OptionGraph:
def __init__(self):
self.header = []
self.footer = []
self.sections = {}
self.current = self.header
def parse(self, filename):
def parse_label(li... | 2.578125 | 3 |
config.py | dodo0822/demucs-frontend | 1 | 12799479 | from environs import Env
env = Env()
env.read_env()
db_host = env.str('DB_HOST', 'localhost')
db_port = env.int('DB_PORT', 27017) | 1.953125 | 2 |
easyquotation_enhance/__init__.py | veink-y/easyquotation_enhance | 5 | 12799480 | from .sina import SinaQuotation
from .tencent import TencentQuotation
from .helpers import update_stock_codes, stock_a_hour
__version__ = "0.0.0.1"
__author__ = "demonfinch"
| 1.304688 | 1 |
Python Files/ImageSizeEqualizer.py | suneel87/Online_Voting_System | 0 | 12799481 | import cv2
def image_equalize(imgA, imgB):
new_size = max(imgA.shape, imgB.shape)
new_imgA = cv2.resize(imgA, new_size)
new_imgB = cv2.resize(imgB, new_size)
return new_imgA, new_imgB
| 2.796875 | 3 |
bostaSDK/pickup/get/__init__.py | bostaapp/bosta-python | 0 | 12799482 | from .GetPickupDetailsRequest import GetPickupDetailsRequest
from .GetPickupDetailsResponse import GetPickupDetailsResponse
| 1.140625 | 1 |
kegs/views.py | akithegood/ohsiha2020 | 0 | 12799483 | <filename>kegs/views.py
from django.shortcuts import render, redirect, get_object_or_404
from kegs.forms import BeerForm, KegForm
from kegs.models import Beer, Keg
# Create your views here.
def keg_detail(request, pk):
beer_obj = Beer.objects.get(pk=pk)
keg_objs = Keg.objects.filter(beer_id=beer_obj.id)
co... | 2.28125 | 2 |
time_cross_validation/TimeCV.py | rick12000/time-series-cross-validation | 0 | 12799484 | <reponame>rick12000/time-series-cross-validation
class TimeCV:
def __init__(self, X, train_sample_size = None, test_sample_size = None, step = 1):
#initiate variables:
self.X = X
self.train_sample_size = train_sample_size
self.test_sample_size = test_sample_size
sel... | 3.25 | 3 |
src/data/preprocess.py | KunalK27/Automatic-License-Plate-Recognition | 26 | 12799485 | import click
import pandas as pd
@click.command()
@click.option("--input-path", "-i", default = "data/0_raw/", required=True,
help="Path to csv file to be processed.",
)
@click.option("--output-path", "-o", default="data/3_processed/",
help="Path to csv file to store the result.")
def main(input_path, output_... | 3.75 | 4 |
frameworks/pycellchem-2.0/src/RD/WritePNG.py | danielrcardenas/ac-course-2017 | 0 | 12799486 | <reponame>danielrcardenas/ac-course-2017
#---------------------------------------------------------------------------
#
# WritePNG.py: writes compressed, true-color RGBA PNG files
#
# RGBA stands for "Red Green Blue Alpha", where alpha is the opacity level
#
# extracted from:
# http://stackoverflow.com/questions/902761... | 2.875 | 3 |
lib/10x/10xfastq.py | shengqh/ngsperl | 6 | 12799487 | <filename>lib/10x/10xfastq.py<gh_stars>1-10
import argparse
import sys
import logging
import os
import csv
import gzip
DEBUG=False
NotDEBUG=not DEBUG
parser = argparse.ArgumentParser(description="Extract barcode and UMI from 10x fastq first read file.",
formatter_class=ar... | 2.484375 | 2 |
tests/test_remote.py | inverse/Hue-remotes-HASS | 0 | 12799488 | """Tests for remote.py."""
import logging
from datetime import timedelta
import pytest
from custom_components.hueremote import DOMAIN
from custom_components.hueremote.data_manager import HueSensorData
from custom_components.hueremote.hue_api_response import (
parse_hue_api_response,
parse_rwl,
parse_zgp,
... | 2.03125 | 2 |
App/McCloud/views.py | ssziolkowski/App | 0 | 12799489 | <filename>App/McCloud/views.py
from django.shortcuts import render
from .text_generator import create
# Create your views here.
def text_generation(request):
context = {}
if request.method == "POST":
file = request.FILES.get("file")
if file.name.lower().endswith(('.txt')):
context[... | 2.265625 | 2 |
training_accuracy.py | Supreme-Sector/Hand-Sign-Detection-Application | 0 | 12799490 | <reponame>Supreme-Sector/Hand-Sign-Detection-Application
import data_loader
import network
import _pickle as cPickle
f=open("neural_network.pickle","rb")
net=cPickle.load(f)
f.close()
training_data, test_data=data_loader.load_data()
num_correct = net.evaluate(training_data)
print("{}/{} correct".format(... | 2.375 | 2 |
online_store/apps/products/migrations/0005_alter_productimage_is_main.py | oocemb/Online_store | 0 | 12799491 | <filename>online_store/apps/products/migrations/0005_alter_productimage_is_main.py
# Generated by Django 4.0.2 on 2022-02-23 17:14
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('products', '0004_productimage_is_main'),
]
operations = [
... | 1.226563 | 1 |
bindings/python/examples/mouse_game.py | augustye/muniverse | 380 | 12799492 | <filename>bindings/python/examples/mouse_game.py
"""
Simple program to demonstrate how to use muniverse on a
game that takes mouse events.
"""
import sys
import numpy as np
sys.path.insert(0, '..')
import muniverse # noqa: E402
def main():
print('Looking up environment...')
spec = muniverse.spec_for_name('... | 3.5 | 4 |
pyani/aniblastall.py | widdowquinn/pyani | 144 | 12799493 | # -*- coding: utf-8 -*-
# (c) University of Strathclyde 2021
# Author: <NAME>
#
# Contact: <EMAIL>
#
# <NAME>,
# Strathclyde Institute for Pharmacy and Biomedical Sciences,
# Cathedral Street,
# Glasgow,
# G4 0RE
# Scotland,
# UK
#
# The MIT License
#
# Copyright (c) 2021 University of Strathclyde
#
# Permission is her... | 1.757813 | 2 |
plotter.py | garrettkatz/rnn-fxpts | 2 | 12799494 | <gh_stars>1-10
"""
Convenience wrappers around matplotlib plotting functions.
Points are handled in matrix columns rather than separate arguments for separate coordinates.
"""
import numpy as np
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
def plot(ax, X, *args, **kwargs):
"""
Plot 2... | 3.515625 | 4 |
gcode_gen/assembly.py | tulth/gcode_gen | 0 | 12799495 | from functools import partial
from collections.abc import MutableSequence
from . import base_types
from . import tree
from . import transform
from .state import CncState
from . import point as pt
from . import action
class Assembly(tree.Tree, transform.TransformableMixin):
'''tree of assembly items'''
def __i... | 2.21875 | 2 |
locallib/catalog/views.py | joseph-njogu/Django_local_lib | 0 | 12799496 |
from django.shortcuts import render
# # from django.shortcuts import get_object_or_404
# from django.http import HttpResponseRedirect
# from django.urls import reverse
import datetime
from django.contrib.auth.decorators import permission_required
from django.views.generic.edit import CreateView, UpdateView, DeleteVi... | 2.375 | 2 |
dags/landsat_scenes_sync/landsat_scenes_fill_gaps.py | digitalearthafrica/deafrica-airflow | 1 | 12799497 | """
# Read report and generate messages to fill missing scenes
#### Utility utilization
The DAG can be parameterized with run time configurations `scenes_limit`, which receives a INT as value.
* The option scenes_limit limit the number of scenes to be read from the report,
therefore limit the number of messages to be... | 2.296875 | 2 |
bouncer/api/views/auth/reset_password.py | ikechuku/bouncer_rest_api | 0 | 12799498 | <reponame>ikechuku/bouncer_rest_api<gh_stars>0
from rest_framework import status
from rest_framework.response import Response
from rest_framework.views import APIView
import bcrypt
from ...models.user import User
class ResetPassword(APIView):
def post(self, request):
data = request.data
passwor... | 2.390625 | 2 |
alembic/versions/799310dca712_increase_sql_path_column_length_to_128.py | SnaKyEyeS/flask-track-usage | 46 | 12799499 | """Increase sql path column length to 128
Revision ID: 799310dca712
Revises: ca514840f404
Create Date: 2020-04-09 11:34:05.456439
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '799310dca712'
down_revision = 'ca514840f404'
branch_labels = None
depends_on = Non... | 1.390625 | 1 |
project/asylum/management/commands/generate_all.py | jssmk/asylum | 1 | 12799500 | # -*- coding: utf-8 -*-
from django.core.management.base import BaseCommand, CommandError
from asylum.tests.fixtures.full import generate_all
class Command(BaseCommand):
help = 'Generates full set of test data'
def add_arguments(self, parser):
pass
def handle(self, *args, **options):
ge... | 1.796875 | 2 |
viewer_3d.py | tek5030/lab-camera-pose-py | 0 | 12799501 | import numpy as np
import pyvista as pv
from pylie import SE3
class Viewer3D:
"""Visualises the lab in 3D"""
def __init__(self):
"""Sets up the 3D viewer"""
self._plotter = pv.Plotter()
# Add scene origin and plane
scene_plane = pv.Plane(i_size=1000, j_size=1000)
self... | 2.859375 | 3 |
pinot/data/tests/test_temporal.py | choderalab/pinot | 13 | 12799502 | import pytest
def test_import():
""" """
import pinot.data.datasets
@pytest.fixture
def moonshot():
""" """
import pinot
ds = pinot.data.moonshot_with_date
return ds
def test_moonshot(moonshot):
"""
Parameters
----------
moonshot :
Returns
-------
"... | 2.109375 | 2 |
tests/unittest/test_exceptions.py | YuriyLisovskiy/NeuralNetwork | 1 | 12799503 | <reponame>YuriyLisovskiy/NeuralNetwork<filename>tests/unittest/test_exceptions.py
import unittest
from neural_network.network import net
from neural_network.config.config import INPUT_LAYER, HIDDEN_LAYERS, OUTPUT_LAYER
class TestExceptions(unittest.TestCase):
def test_last_layer_exception(self):
with self.assertR... | 2.84375 | 3 |
nixutil/plat_util/freebsd.py | cptpcrd/nixutil | 0 | 12799504 | <gh_stars>0
# pylint: disable=invalid-name,too-few-public-methods
import ctypes
import os
from typing import Iterator, Optional
from . import bsd_util
CTL_KERN = 1
KERN_PROC = 14
KERN_PROC_FILEDESC = 33
KF_TYPE_VNODE = 1
PATH_MAX = 1024
pid_t = ctypes.c_int
sa_family_t = ctypes.c_uint8
_SS_MAXSIZE = 128
_SS_ALIG... | 2.0625 | 2 |
opensda_flasher/config.py | jed-frey/opensda_flasher | 8 | 12799505 | <reponame>jed-frey/opensda_flasher
"""Module config functions."""
import os
import sys
from configparser import ConfigParser
from configparser import ExtendedInterpolation
def read_config(local_config=None):
"""Read Configuration File."""
if local_config is None:
local_config = ""
mod... | 2.25 | 2 |
test/mock_extensions.py | BenjaminHamon/BuildService | 2 | 12799506 | import asyncio
from unittest.mock import MagicMock
class MockException(Exception):
pass
# AsyncMock is new in Python 3.8
class AsyncMock(MagicMock):
async def __call__(self, *args, **kwargs): # pylint: disable = invalid-overridden-method, useless-super-delegation
return super().__call__(*args, **kwargs)
class... | 2.578125 | 3 |
Section 1/Section1/Video4_collections_1_tuples.py | PacktPublishing/-Python-By-Example | 8 | 12799507 | '''
Created on Mar 31, 2018
@author: <NAME>
'''
# ------------ Tuples ------------
number_tuple = (1, 2, 3, 4) # tuples use parentheses for creation
letter_tuple = ('a', 'b', 'c', 'd')
mixed_tuple = (1, 'a', 2, 'b', [88, 99]) # can mix different types
print(number_tuple)
pri... | 4.03125 | 4 |
examples/salesman.py | Eyjafjallajokull/pyga | 0 | 12799508 | import sys
import os
import logging
sys.path.append(os.environ["PWD"])
from pyga import *
population_size = 10
elite_count = 2
crossover_points = 2
crossover_mutate_probability = 0.2
max_weight = 15
city_names = ['a', 'b', 'c', 'd']
distances = [
# a b c d
[ 0, 130, 180, 300], # a
[130, 0, 32... | 2.609375 | 3 |
begins-with-t.py | babubaskaran/pands-problem-set | 0 | 12799509 | <reponame>babubaskaran/pands-problem-set
# Author : <NAME>
# Date : 05/04/2019 Time : 19:00 pm
# Solution for problem number 2
# Version 1.0
# import the datetime of the system using import syntax
import datetime
# checking the weekday number is equal to 1 using if condition
if datetime.datetime.today().weekday() ==... | 4.34375 | 4 |
bin/automated_insert.py | kevinmooreiii/mechdriver | 1 | 12799510 | """ Add a species to your database
usiing a log file
"""
import sys
import os
import autofile
import automol
from mechanalyzer.inf import thy as tinfo
from mechanalyzer.inf import rxn as rinfo
from mechanalyzer.inf import spc as sinfo
import elstruct
import autorun
from mechroutines.es._routines.conformer import _sav... | 1.984375 | 2 |
tinycord/middleware/interactions_create.py | HazemMeqdad/TinyCord | 0 | 12799511 | import typing
if typing.TYPE_CHECKING:
from ..client import Client
from ..core import Gateway, GatewayDispatch
from ..models import SlashContext, Option
async def interaction_create(client: "Client", gateway: "Gateway", event: "GatewayDispatch") -> typing.List[typing.Awaitable]:
"""
|coro|
... | 2.328125 | 2 |
promoterz/statistics.py | emillj/gekkoJaponicus | 0 | 12799512 | #!/bin/python
from deap import tools
import numpy as np
import os
statisticsNames = {'avg': 'Average profit',
'std': 'Profit variation',
'min': 'Minimum profit',
'max': 'Maximum profit',
'size': 'Population size',
'maxsize': ... | 2.625 | 3 |
djangoProject/mysite/views.py | bt1401/Django | 0 | 12799513 | <reponame>bt1401/Django
from django import urls
from django.db.models.fields import URLField
from django.shortcuts import render, redirect
from django.http import HttpResponse, request
from django.views import View
from.models import Title, Headline, Artical
from.forms import PostForm
from django.contrib.auth import au... | 2.4375 | 2 |
src/tickers.py | rotomer/nlp-project | 0 | 12799514 | <reponame>rotomer/nlp-project
SNP_TICKERS = ['AAPL', 'XOM', 'GE', 'CVX', 'MSFT', 'IBM', 'T', 'GOOG', 'PG', 'JNJ', 'PFE', 'WFC', 'BRK.B', 'JPM', 'PM',
'KO', 'MRK', 'VZ', 'WMT', 'ORCL', 'INTC', 'PEP', 'ABT', 'QCOM', 'CSCO', 'SLB', 'C', 'CMCSA', 'BAC',
'DIS', 'MCD', 'AMZN', 'HD', 'KFT', 'V',... | 1.40625 | 1 |
chapter_3/redirection-options.py | bimri/programming_python | 0 | 12799515 | "Other Redirection Options: os.popen and subprocess Revisited"
'''
the built-in os.popen function and its subprocess.Popen relative,
which provide a way to redirect another command’s streams from
within a Python program. these tools can be used to run a shell
command line.
Other Redirection Options: os.popen and su... | 3.59375 | 4 |
DeepTreeAttention/callbacks/callbacks.py | zoeyingz/DeepTreeAttention | 1 | 12799516 | #Callbacks
"""Create training callbacks"""
import os
import numpy as np
import pandas as pd
from datetime import datetime
from DeepTreeAttention.utils import metrics
from DeepTreeAttention.visualization import visualize
from tensorflow.keras.callbacks import ReduceLROnPlateau
from tensorflow.keras.callbacks import Ca... | 2.609375 | 3 |
mini_projects/shrubbery/shrubbery.py | Ustabil/Python-part-one | 0 | 12799517 | # program template for mini-project 0
# Modify the print statement according to
# the mini-project instructions
#CodeSkulptor link:
#http://www.codeskulptor.org/#user40_lXiJqEZDdrSdSu5.py
print "We want... a shrubbery!" | 1.773438 | 2 |
tests/dlkit/primordium/locale/types/test_format.py | UOC/dlkit | 2 | 12799518 | <reponame>UOC/dlkit<gh_stars>1-10
import pytest
from dlkit.abstract_osid.osid import errors
from dlkit.primordium.locale.types.format import get_type_data
class TestFormat(object):
def test_get_type_data_with_format(self):
results = get_type_data('troff')
assert results['identifier'] == 'TROFF'
... | 2.078125 | 2 |
app/targetbalance.py | woudt/bunq2ifttt | 27 | 12799519 | <reponame>woudt/bunq2ifttt
"""
Target balance
Handles the target balance internal/external actions
"""
import json
import uuid
from flask import request
import bunq
import payment
def target_balance_internal():
""" Execute a target balance internal action """
data = request.get_json()
print("[target_b... | 2.53125 | 3 |
setup.py | Hasenpfote/malloc_tracer | 2 | 12799520 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
import re
from setuptools import setup
# Get version without importing, which avoids dependency issues
def get_version():
with open('malloc_tracer/version.py') as version_file:
return re.search(r"""__version__\s+=\s+(['"])(?P<version>.+?)\1""",
... | 1.976563 | 2 |
parse.py | endorama/parse-medici-torino | 3 | 12799521 | <gh_stars>1-10
import datetime
import fileinput
import functools
import json
import os
import re
import sys
import unittest
import urllib.parse
import requests
from fixups import ESPANDI_INDIRIZZO
MESI = {
'gennaio': 1,
'febbraio': 2,
'marzo': 3,
'aprile': 4,
'maggio': 5,
'giugno': 6,
'lu... | 2.625 | 3 |
tests/linear/assembly/test_assembly.py | LMNS3d/sharpy | 0 | 12799522 | <filename>tests/linear/assembly/test_assembly.py
'''
Test assembly
<NAME>, 29 May 2018
'''
import os
import copy
import warnings
import unittest
import itertools
import numpy as np
import scipy.linalg as scalg
import sharpy.utils.h5utils as h5utils
import sharpy.linear.src.assembly as assembly
import sharpy.linear.sr... | 2.203125 | 2 |
CIFA10/resnet.py | sy2616/DATA | 2 | 12799523 | <filename>CIFA10/resnet.py
import torch
from torch import nn
from torch.nn import functional as F
class ResBl(nn.Module):
def __init__(self,ch_in,ch_out,stride=1):
super(ResBl,self).__init__()
self.conv1=nn.Conv2d(ch_in,ch_out,kernel_size=3,stride=stride,padding=1)
self.bn1=nn.BatchNorm2d(c... | 2.6875 | 3 |
tools.py | CoderChen01/smart_trash_can | 0 | 12799524 | <reponame>CoderChen01/smart_trash_can
import base64
from PIL import Image, ImageDraw, ImageFont
import cv2
import configs
FONT_SYTLE = ImageFont.truetype(configs.IMAGE_FONT, 25)
def draw_image(img, text, color):
img = Image.fromarray(cv2.cvtColor(img, cv2.COLOR_BGR2RGB))
draw = ImageDraw.Draw(img)
dra... | 2.734375 | 3 |
rtpipe/cli.py | caseyjlaw/rtpipe | 9 | 12799525 | import rtpipe.RT as rt
import rtpipe.parsecands as pc
import rtpipe.parsesdm as ps
import rtpipe.reproduce as reproduce
import click, os, glob
import logging
logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(name)s - %(levelname)s - %(message)s')
logging.captureWarnings(True)
logger = logging.getLogger(__... | 2.21875 | 2 |
collabera_python.py | dedds001/snowflake-tutorials | 0 | 12799526 | <reponame>dedds001/snowflake-tutorials<filename>collabera_python.py<gh_stars>0
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Wed Jul 3 14:45:54 2019
@author: deborahedds
"""
###get files from http
import requests
r=requests.get("https://raw.githubusercontent.com/becloudready/snowflake-tutorials/maste... | 2.53125 | 3 |
auth_custom/apps.py | u-transnet/utransnet-gateway | 0 | 12799527 | <reponame>u-transnet/utransnet-gateway
from django.apps import AppConfig
class AuthCustomConfig(AppConfig):
name = 'auth_custom'
| 1.304688 | 1 |
vespene/migrations/0009_remove_workerpool_sudo_password.py | vespene-io/vespene | 680 | 12799528 | # Generated by Django 2.1.2 on 2018-12-16 13:01
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('vespene', '0008_auto_20181106_2233'),
]
operations = [
migrations.RemoveField(
model_name='workerpool',
name='sudo_password'... | 1.296875 | 1 |
pypet/tests/integration/environment_test.py | dilawar/pypet | 85 | 12799529 | <gh_stars>10-100
__author__ = '<NAME>'
import os
import platform
import logging
import time
import numpy as np
from pypet.trajectory import Trajectory, load_trajectory
from pypet.utils.explore import cartesian_product
from pypet.environment import Environment
from pypet.storageservice import HDF5StorageService
from p... | 1.921875 | 2 |
lib/python3.7/site-packages/ravencoin/core/__init__.py | RavenGraph/api | 0 | 12799530 | <gh_stars>0
# Copyright (C) 2018 The python-ravencoinlib developers
#
# This file is part of python-ravencoinlib.
#
# It is subject to the license terms in the LICENSE file found in the top-level
# directory of this distribution.
#
# No part of python-ravencoinlib, including this file, may be copied, modified,
# propag... | 1.835938 | 2 |
conditions/toy_shop.py | MaggieIllustrations/softuni-github-programming | 0 | 12799531 | <reponame>MaggieIllustrations/softuni-github-programming
holiday_price = float(input())
puzzle_count = int(input())
dolls_count = int(input())
teddy_bears_count = int(input())
minions_count = int(input())
trucks_count = int(input())
#
total_price_dolls = dolls_count * 3
total_price_puzzles = puzzle_count * ... | 4.03125 | 4 |
profile_generator/generator_test.py | nethy/profile-generator | 0 | 12799532 | from unittest import TestCase
from unittest.mock import Mock, patch
from profile_generator import generator
from profile_generator.generator import (
ConfigFileReadError,
InvalidConfigFileError,
NoConfigFileError,
OutputDirCreationFailure,
ProfileWriteError,
TemplateFileReadError,
)
from profil... | 2.703125 | 3 |
lib/conda.py | rdmolony/scaffold | 0 | 12799533 | <reponame>rdmolony/scaffold<filename>lib/conda.py
def run_in_env(c, command, env):
commands = ['eval "$(conda shell.bash hook)"', f'conda activate {env}']
commands.append(command)
c.run(' && '.join(commands))
| 1.695313 | 2 |
python/python_logging_note.py | tszandy/notes | 0 | 12799534 | import logging
#store loggging file in ~/filename.log with encoding utf-8 and anything above log level logging DEBUG which is everything.
logging.basicConfig(filename="filename.log",encoding="utf-8",level = logging.DEBUG)
logging.debug()
logging.info()
logging,warning()
logging.error()
logging.critical()
# One logger... | 2.984375 | 3 |
quiz/users/serializers.py | diego-marcelino/valora-quiz | 0 | 12799535 | from django.contrib.auth import authenticate
from django.contrib.auth import get_user_model
from django.utils.translation import gettext_lazy as _
from rest_framework import serializers
from rest_framework.exceptions import AuthenticationFailed
from rest_framework_simplejwt.tokens import RefreshToken
User = get_user... | 2.296875 | 2 |
2017/20/asteroids.py | xocasdashdash/advent-of-code | 0 | 12799536 | data = open("input","r").read()
def parse(particle):
return [list(map(int, p[3:-1].split(","))) for p in particle.split(", ")]
def step(d):
d[1][0] += d[2][0]
d[1][1] += d[2][1]
d[1][2] += d[2][2]
d[0][0] += d[1][0]
d[0][1] += d[1][1]
d[0][2] += d[1][2]
def part1(data):
particles = [pa... | 3.09375 | 3 |
create_indexes.py | AuthEceSoftEng/jira-apache-downloader | 0 | 12799537 | <reponame>AuthEceSoftEng/jira-apache-downloader<gh_stars>0
import pymongo
from properties import database_host_and_port
if __name__ == "__main__":
client = pymongo.MongoClient(database_host_and_port)
db = client["jidata"]
db["issues"].create_index('projectname')
db["users"].create_index('projectname')
db[... | 2.09375 | 2 |
src/signalalign/remove_sa_analyses.py | UCSC-nanopore-cgl/signalAlign | 5 | 12799538 | #!/usr/bin/env python
"""Remove embedded signalalign analyses from files"""
########################################################################
# File: remove_sa_analyses.py
# executable: remove_sa_analyses.py
#
# Author: <NAME>
# History: 02/06/19 Created
#########################################################... | 2.4375 | 2 |
Max_elem.py | ScriptErrorVGM/Project2021 | 0 | 12799539 | # 1
def max_elem(a):
max0 = a[0]
for elem in a:
if elem > max0:
max0 = elem
return max0
list0 = [2,3,4,5,6,7,1,2,3]
result = max_elem(list0)
print("#1 :",result) # return 7
# 2
list1 = [10,12,3,14,20,7,6,5]
list1.sort()
print("#2 :",list1[-1])
# 3
list2 = [3,5,9,7,... | 3.921875 | 4 |
frameworks/Python/falcon/app_orjson.py | http4k/FrameworkBenchmarks | 2 | 12799540 | #!/usr/bin/env python
import orjson
from falcon import media
from app import wsgi
# custom JSON handler
JSONHandler = media.JSONHandler(dumps=orjson.dumps, loads=orjson.loads)
extra_handlers = {
"application/json": JSONHandler,
"application/json; charset=UTF-8": JSONHandler
}
wsgi.req_options.media_handlers.u... | 1.71875 | 2 |
setup.py | kateliev/vfjLib | 5 | 12799541 | <filename>setup.py
from __future__ import absolute_import, division, print_function
import re
import sys
from codecs import open
from os import path
from setuptools import find_packages, setup
folderLib = 'Lib'
packageName = find_packages(folderLib)[0]
def get_version(*args):
verpath = (folderLib, packageName, ... | 2.1875 | 2 |
cottonformation/res/elasticbeanstalk.py | gitter-badger/cottonformation-project | 0 | 12799542 | # -*- coding: utf-8 -*-
"""
This module
"""
import attr
import typing
from ..core.model import (
Property, Resource, Tag, GetAtt, TypeHint, TypeCheck,
)
from ..core.constant import AttrMeta
#--- Property declaration ---
@attr.s
class EnvironmentOptionSetting(Property):
"""
AWS Object Type = "AWS::Elast... | 2.15625 | 2 |
distributed/protocol/cupy.py | replicahq/distributed | 0 | 12799543 | """
Efficient serialization GPU arrays.
"""
import cupy
from .cuda import cuda_serialize, cuda_deserialize
class PatchedCudaArrayInterface:
"""This class do two things:
1) Makes sure that __cuda_array_interface__['strides']
behaves as specified in the protocol.
2) Makes sure that the cu... | 2.453125 | 2 |
doc/autosar4_api/examples/create_composition_component.py | SHolzmann/autosar | 199 | 12799544 | import autosar
ws = autosar.workspace("4.2.2")
components = ws.createPackage("ComponentTypes")
swc = components.createCompositionComponent("MyComposition")
print(swc.name)
| 1.789063 | 2 |
opyapi/schema/schema.py | dkraczkowski/opyapi | 5 | 12799545 | <reponame>dkraczkowski/opyapi
from abc import ABCMeta
from typing import Any
from typing import Dict
from typing import List
from typing import Type
from .errors import ValidationError
from .types import Object
from .types import String
from .validators.validate import validate
class SchemaMeta(ABCMeta):
def __n... | 2.546875 | 3 |
Manannikov_K_DZ_1/test_job_#2.py | manannikovkonstantin/1824_GB_Python_1 | 0 | 12799546 | <gh_stars>0
def function(value):
degree = []
sum_numers = 0
for i in range(1, 1000, 2):
degree.append(i ** 3 + value)
for item in degree:
str_degree = str(item)
pred_sum = 0
for x in str_degree:
int_degree = int(x)
pred_sum += int_degree
... | 3.5625 | 4 |
date_time/calendar.py | nayanapardhekar/Python | 37 | 12799547 | '''
Task
You are given a date. Your task is to find what the day is on that date.
Input Format
A single line of input containing the space separated month, day and year, respectively, in format.
Constraints
* 2000<year<3000
Output Format
Output the correct day in capital letters.
Sample Input
08 05 2015
Sampl... | 4.1875 | 4 |
travel/bean/userwrapper.py | sausage-team/travel-notes | 0 | 12799548 | <gh_stars>0
from core.bean.wrapper import *
class UserWrapper(Wrapper):
filter = ['phone', 'password']
def __init__(self, status=0, data={}):
if isinstance(data, list):
for val in data:
self.remove_key(val)
else:
self.remove_key(data)
super().__i... | 2.25 | 2 |
webapp/app.py | matthansen0/FitbitOnFHIR | 8 | 12799549 | import os, json
import cmd
import asyncio
from fitbit import Fitbit
from flask import Flask, render_template, url_for, session, redirect
from authlib.integrations.flask_client import OAuth
from azure.keyvault.secrets import SecretClient
from azure.identity import DefaultAzureCredential
from azure.core.exceptions import... | 2.421875 | 2 |
captain_hook/comms/base/base_comm.py | brantje/captain_hook | 2 | 12799550 | <gh_stars>1-10
from __future__ import absolute_import
import yaml
from os.path import join
class BaseComm:
def __init__(self, config):
self.config = config
def setup(self):
raise NotImplementedError
def communicate(self):
raise NotImplementedError
def _load_config(self):
... | 2.296875 | 2 |