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 |
|---|---|---|---|---|---|---|
tottle/types/objects/contact.py | muffleo/tottle | 12 | 12789951 | from typing import Optional
from pydantic import BaseModel
class Contact(BaseModel):
phone_number: Optional[str] = None
first_name: Optional[str] = None
last_name: Optional[str] = None
user_id: Optional[int] = None
vcard: Optional[str] = None
| 2.6875 | 3 |
functions/args_parameters.py | danielkpodo/python-zero-to-mastery | 0 | 12789952 | def greet_user(username, emoji):
print("Welcome {}, we are happy to have you{}".format(username, emoji))
greet_user("narh", "🙋")
greet_user("kpodo", '🍀')
# When you define a function you give it what we call parameters
# When you are invoking the function you pass to it arguments
| 3.390625 | 3 |
api/beers/tests/test_deactivate_inactive.py | haavardnk/Vinmonopolet-x-Untappd | 0 | 12789953 | <reponame>haavardnk/Vinmonopolet-x-Untappd<filename>api/beers/tests/test_deactivate_inactive.py
import pytest
from django.utils import timezone
from datetime import timedelta
from beers.models import Beer
from beers.tasks import deactivate_inactive
@pytest.mark.django_db
def test_deactivate_inactive_beer():
... | 2.296875 | 2 |
steelpy/sections/shapes/elliptical.py | svortega/steelpy | 4 | 12789954 | #
# Copyright (c) 2019-2021 steelpy
#
# Python stdlib imports
import math
#
# package imports
#import steelpy.units.control as units
#from steelpy.sectionproperty.shapes.iomodule import (find_section_dimensions,
# get_dimension)
# --------------------------------... | 2.546875 | 3 |
Backend/oeda/rtxlib/executionstrategy/SelfOptimizerStrategy.py | iliasger/OEDA | 2 | 12789955 | <filename>Backend/oeda/rtxlib/executionstrategy/SelfOptimizerStrategy.py
from colorama import Fore
from skopt import gp_minimize
from oeda.log import *
from oeda.rtxlib.execution import experimentFunction
from oeda.rtxlib.executionstrategy import applyInitKnobs
from oeda.rtxlib.executionstrategy import applyDefaultKnob... | 2.578125 | 3 |
tests/test_plotting.py | fredchettouh/neural-processes | 0 | 12789956 | <gh_stars>0
from cnp.plotting import get_contxt_coordinates, get_colour_based_idx, Plotter
import torch
def test_get_contxt_coordinates():
contxt = torch.tensor([0, 1, 2, 3])
rows, cols = get_contxt_coordinates(contxt, 2)
assert (rows[0] == 0 and rows[2] == 1)
assert (cols[0] == 0 and cols[2] == 0)
... | 2.140625 | 2 |
demo/demo/urls.py | JanMalte/processlib | 1 | 12789957 | from django.conf.urls import url, include
from rest_framework import routers
from crm_inbox.flows import * # noqa
from processlib.views import (ProcessViewSet)
router = routers.DefaultRouter()
router.register('process', ProcessViewSet)
urlpatterns = [
url(r'^process/', include('processlib.urls', namespace='pr... | 1.734375 | 2 |
home/migrations/0004_auto_20180517_0440.py | marcanuy/keraban | 4 | 12789958 | <reponame>marcanuy/keraban
# Generated by Django 2.0.5 on 2018-05-17 04:40
from django.db import migrations
import wagtail.core.blocks
import wagtail.core.fields
import wagtail.images.blocks
class Migration(migrations.Migration):
dependencies = [
('home', '0003_standardpage_subtitle'),
]
operat... | 1.796875 | 2 |
examples/4.py | Time2003/lr10 | 0 | 12789959 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
if __name__ == "__main__":
a = {0, 1, 2, 3}
print(len(a))
a.add(4)
print(a)
a = {0, 1, 2, 3}
a.remove(3)
print(a)
a = {0, 1, 2, 3}
a.clear()
print(a) | 3.65625 | 4 |
flask_run.py | rednafi/ashen | 4 | 12789960 | from dynaconf import settings
from app import create_app
application = create_app()
# runs this only when the environment is 'development'
if settings.ENVIRONMENT == "development" and settings.GUNICORN is False:
application.run(host="0.0.0.0", port=settings.FLASK_CONFIG.PORT, debug=True)
| 2.03125 | 2 |
src/pysparkbundle/filesystem/FilesystemInterface.py | daipe-ai/pyspark-bundle | 0 | 12789961 | from abc import ABC, abstractmethod
class FilesystemInterface(ABC):
@abstractmethod
def exists(self, path: str):
pass
@abstractmethod
def put(self, path: str, content: str, overwrite: bool = False):
pass
@abstractmethod
def makedirs(self, path: str):
pass
@abstra... | 3.578125 | 4 |
vmf_embeddings/third_party/dml_cross_entropy/resnet.py | google-research/vmf_embeddings | 8 | 12789962 | # coding=utf-8
# Copyright 2021 The vMF Embeddings Authors.
#
# 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 applicabl... | 2.109375 | 2 |
aioruuvitag/aioruuvitag_bleak.py | hulttis/ruuvigw | 7 | 12789963 | # coding=utf-8
# !/usr/bin/python3
# Name: aioruuvitag_bleak - Bluetooth Low Energy platform Agnostic Klient by <NAME>
# https://github.com/hbldh/bleak.git
# Copyright: (c) 2019 TK
# Licence: MIT
#
# sudo apt install bluez
# requires bluez 5.43
# -----------------------... | 2.03125 | 2 |
setup.py | Spico197/REx | 4 | 12789964 | import os
import setuptools
from rex import __version__
readme_filepath = os.path.join(os.path.dirname(os.path.abspath(__file__)), "README.md")
with open(readme_filepath, "r") as fh:
long_description = fh.read()
setuptools.setup(
name="pytorch-rex",
version=__version__,
author="<NAME>",
author_... | 1.460938 | 1 |
kf_model_fhir/mappers/resources/kfdrc_research_study.py | kids-first/kf-model-fhir | 3 | 12789965 | """
This module converts Kids First studies to FHIR kfdrc-research-study
(derived from FHIR ResearchStudy).
"""
from kf_lib_data_ingest.common.concept_schema import CONCEPT
from common.utils import make_identifier, make_select, get
RESOURCE_TYPE = "ResearchStudy"
def yield_kfdrc_research_studies(
eng, table, tar... | 2.265625 | 2 |
elasticapm/transport/base.py | shareablee/apm-agent-python | 0 | 12789966 | <reponame>shareablee/apm-agent-python
# -*- coding: utf-8 -*-
import gzip
import logging
import threading
import timeit
from collections import defaultdict
from elasticapm.contrib.async_worker import AsyncWorker
from elasticapm.utils import json_encoder
from elasticapm.utils.compat import BytesIO
logger = logging.get... | 1.960938 | 2 |
Hashing/count_dist_elem_window.py | lakshyarawal/pythonPractice | 0 | 12789967 | """ Count Distinct Elements in Each Window: We are given an array and a number k (k<=n).
We need to find distinct elements in each k sized window in this array"""
def distinct_in_window(arr, win_sz) -> list:
result = []
curr_dict = dict()
for i in range(win_sz):
if arr[i] in curr_dict.keys():
... | 3.90625 | 4 |
example.py | lingyunfeng/PyDDA | 49 | 12789968 | import pyart
import pydda
from matplotlib import pyplot as plt
import numpy as np
berr_grid = pyart.io.read_grid("berr_Darwin_hires.nc")
cpol_grid = pyart.io.read_grid("cpol_Darwin_hires.nc")
sounding = pyart.io.read_arm_sonde(
"/home/rjackson/data/soundings/twpsondewnpnC3.b1.20060119.231600.custom.cdf")
print(be... | 2.28125 | 2 |
deprecated/jutge-like/X10534.py | balqui/pytokr | 0 | 12789969 | def make_get_toks(f=None):
"make iterator and next functions out of iterable of split strings"
from sys import stdin
from itertools import chain
def sp(ln):
"to split the strings with a map"
return ln.split()
def the_it():
"so that both results are callable in similar manne... | 3.234375 | 3 |
acceptance_tests/utilities/collex_helper.py | ONSdigital/ssdc-rm-acceptance-tests | 0 | 12789970 | <reponame>ONSdigital/ssdc-rm-acceptance-tests
from datetime import datetime, timedelta
import requests
from acceptance_tests.utilities.event_helper import get_emitted_collection_exercise_update
from acceptance_tests.utilities.test_case_helper import test_helper
from config import Config
def add_collex(survey_id, co... | 2.265625 | 2 |
src/api/resources/light_curve/light_curve.py | alercebroker/ztf-api-apf | 0 | 12789971 | from flask_restx import Namespace, Resource
from .parsers import survey_id_parser
from .models import (
light_curve_model,
detection_model,
non_detection_model,
)
from dependency_injector.wiring import inject, Provide
from dependency_injector.providers import Factory
from api.container import AppContainer
f... | 2.109375 | 2 |
resources/lib/basictypes/__init__.py | torstehu/Transmission-XBMC | 22 | 12789972 | """Common data-modeling Python types
The idea of the basictypes package is to provide
types which provide enough metadata to allow an
application to use introspection to perform much
of the housekeeping required to create business
applications.
"""
| 2.390625 | 2 |
c_gan.py | webcok/CGANHumanTrajectory | 1 | 12789973 | <gh_stars>1-10
import tensorflow as tf
from tensorflow.examples.tutorials.mnist import input_data
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.gridspec as gridspec
import os
import random
def plot(samples):
fig = plt.figure()
plt.gca().set_color_cycle(['blue', 'red','green', 'black... | 2.765625 | 3 |
setup.py | ig0774/eulxml | 19 | 12789974 | #!/usr/bin/env python
"""Setup.py for eulxml package"""
from distutils.command.build_py import build_py
from distutils.command.clean import clean
from distutils.command.sdist import sdist
from distutils.core import Command
import os
import sys
import shutil
from setuptools import setup, find_packages
import eulxml
cl... | 2.25 | 2 |
alnitak/tests/cloudflare_test.py | definitelyprobably/alnitak | 0 | 12789975 |
import pytest
import re
from pathlib import Path
from time import sleep
from alnitak import config
from alnitak.api import cloudflare
from alnitak.tests import setup
from alnitak import prog as Prog
from alnitak import exceptions as Except
@pytest.fixture(scope="module")
def cloudflare_api(request):
return Path... | 2.03125 | 2 |
main.py | Sajadrahimi/quarto-monte-carlo | 0 | 12789976 | <filename>main.py
from game.game import Game
game = Game()
print(game.status())
| 1.953125 | 2 |
src/Gon/jrj_spyder.py | somewheve/Listed-company-news-crawl-and-text-analysis | 1 | 12789977 | <filename>src/Gon/jrj_spyder.py
"""
金融界:http://www.jrj.com.cn
股票频道全部新闻:http://stock.jrj.com.cn/xwk/202012/20201203_1.shtml
"""
import __init__
from spyder import Spyder
from Kite import config
from Kite import utils
import time
import logging
logging.basicConfig(level=logging.INFO,
format='%(asc... | 2.390625 | 2 |
pikuli/uia/control_wrappers/menu_item.py | NVoronchev/pikuli | 0 | 12789978 | # -*- coding: utf-8 -*-
from .uia_control import UIAControl
class MenuItem(UIAControl):
''' Контекстное меню, к примеру. '''
CONTROL_TYPE = 'MenuItem'
| 1.382813 | 1 |
earthquakes_package/scripts/dbmanager.py | saramakosa/earthquakes | 0 | 12789979 | <gh_stars>0
"""This module helps a user to manage the database. Only one table ("users") is
available and new users can me added or the existing ones can be removed. See
the argparse options for more information."""
import sqlite3
import argparse
import os
import random
import hashlib
conn = None
cursor = None
db_ab... | 3.359375 | 3 |
pyspedas/mms/eis/mms_eis_spec_combine_sc.py | ergsc-devel/pyspedas | 75 | 12789980 | import numpy as np
# use nanmean from bottleneck if it's installed, otherwise use the numpy one
# bottleneck nanmean is ~2.5x faster
try:
import bottleneck as bn
nanmean = bn.nanmean
except ImportError:
nanmean = np.nanmean
from pytplot import get_data, store_data, options
from ...utilities.tnames import tn... | 2.109375 | 2 |
grb/dataset/__init__.py | Stanislas0/grb | 0 | 12789981 | from .dataset import Dataset, CustomDataset, CogDLDataset
| 1.15625 | 1 |
server/laundry.py | pennlabs/labs-api-server | 9 | 12789982 | import calendar
import datetime
from flask import g, jsonify, request
from pytz import timezone
from requests.exceptions import HTTPError
from sqlalchemy import Integer, cast, exists, func
from server import app, sqldb
from server.auth import auth
from server.base import cached_route
from server.models import Laundry... | 2.640625 | 3 |
configuration.py | praveen-elastic/workplace-search-sharepoint16-connector | 0 | 12789983 | <reponame>praveen-elastic/workplace-search-sharepoint16-connector
import yaml
from yaml.error import YAMLError
from cerberus import Validator
from schema import schema
from sharepoint_utils import print_and_log
class Configuration:
__instance = None
def __new__(cls, *args, **kwargs):
if not Configur... | 2.390625 | 2 |
utils/__init__.py | uthcode/baysourashtra | 0 | 12789984 | import jinja2
veg_cost = 10.00
non_veg_cost = 10.00
JINJA_ENVIRONMENT = jinja2.Environment(
# templates directory is relative to app root.
loader=jinja2.FileSystemLoader('templates'),
extensions=['jinja2.ext.autoescape'],
autoescape=True)
form_template = JINJA_ENVIRONMENT.get_template('form.html')
pay_templa... | 1.710938 | 2 |
lib/modules/SSTIDetector.py | mukeran/dinlas | 2 | 12789985 | # coding:utf-8
import logging
from urllib import parse
from copy import deepcopy
import random
import requests
class SSTIDetector:
def __init__(self, results, reports, **kwargs):
self.results = results
self.reports = reports
self.args = kwargs
self.vulnerable = []
@staticmet... | 2.515625 | 3 |
main.py | Fovik/Translater | 0 | 12789986 | <filename>main.py<gh_stars>0
import wx
import wx.adv
import yaml
from lib import clipboard
TRAY_TOOLTIP = 'System Tray Demo'
ID_MENU_ABOUT = 1025
TRANSLATE_EVENTS_START = 2000
__version__ = '0.0.1'
def ShowAbout(event):
dialog = wx.MessageDialog(None, "Создал <NAME>", caption="О программе", style=wx.OK|wx.CENTRE,... | 2.171875 | 2 |
todo-tags.py | jerheff/pre-commit | 0 | 12789987 | <filename>todo-tags.py
#!/usr/bin/env python3 -s
# Searches passed files for TODO comments.
#
# Prints out (and exits non-zero) if any TODO comments are not in the form:
#
# TODO(DEV-1234): some text
#
# Ensuring all TODOs are either complete when opening the PR, or have a JIRA
# ticket to track the future chang... | 3.015625 | 3 |
lectures/cs285/hw1/cs285/infrastructure/torch_utils.py | ainklain/re_papers | 0 | 12789988 | import torch
from torch import nn
import os
############################################
############################################
class MLP(nn.Module):
def __init__(self, input_size, output_size, n_layers, size, activation=torch.tanh, output_activation=None):
super(MLP, self).__init__()
self.a... | 2.796875 | 3 |
nba_automation/page_objects/BasePage.py | sohailchd/RobotAndLocust | 0 | 12789989 | <reponame>sohailchd/RobotAndLocust
from utilities.BrowserManager import BrowserManager
import conf
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
class BasePage():
_driver = BrowserManager.get_browser()
def __init__(self,url=conf... | 2.84375 | 3 |
edb/testbase/connection.py | Marnixvdb/edgedb | 0 | 12789990 | #
# This source file is part of the EdgeDB open source project.
#
# Copyright 2016-present MagicStack Inc. and the EdgeDB authors.
#
# 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... | 1.789063 | 2 |
tests.py | horoshenkih/artm | 0 | 12789991 | from utils import *
from algorithms import nmf
import numpy as np
import sys
w = 200
d = 100
t = 6
beta0 = 0.01 # const
n_iter = 300
results = open(sys.argv[1], "w")
for run in range(1):
seeds = [30+run,40+run]
for alpha0 in [0.01, 0.02, 0.05]:
#for alpha0 in [0.05, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0... | 2.296875 | 2 |
get_bridge_status.py | joshuakaluba/WellandCanalScraper | 0 | 12789992 | import time
import bridge
import json
import requests
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from selenium.common.exceptions import NoSuchElementException
canal_web_source = 'http://www.greatlakes-seaway.com/R2/jsp/mNiaBrdgStatus.jsp?language=E'
welland_canal_api = 'https://well... | 2.75 | 3 |
tests/helpers.py | floatingpurr/sync_with_poetry | 9 | 12789993 | <gh_stars>1-10
from typing import Optional
import yaml
# A lock file
LOCK_CONTENT = (
"[[package]]\n"
'name = "mypy"\n'
'version = "0.910"\n'
'description = "Optional static typing for Python"\n'
'category = "dev"\n'
"optional = false\n"
'python-versions = ">=3.5"\n'
"[[package]]\n"
... | 2.15625 | 2 |
test/binance_api_tests.py | iswanlun/PatternTradingBot | 0 | 12789994 | <reponame>iswanlun/PatternTradingBot<gh_stars>0
import unittest, os, sys
sys.path.append(os.getcwd() + "\\src")
from binance_stream import BinanceStream
import talib
import numpy as np
class BinanceStreamTests(unittest.TestCase):
def setUp(self) -> None:
super().setUp()
self.stream = BinanceStrea... | 2.546875 | 3 |
September 2020/05-Functions-Advanced/Exercises/05-Odd-or-Even.py | eclipse-ib/Software-University-Professional-Advanced-Module | 0 | 12789995 | command = input()
list_of_numbers = [int(i) for i in input().split()]
result = 0
if command == "Odd":
# odd_numbers = list(filter(lambda x: x % 2 != 0, list_of_numbers))
# print(sum(odd_numbers) * len(list_of_numbers))
result = sum(list(filter(lambda x: x % 2 != 0, list_of_numbers))) * len(list_of_numbers)... | 3.921875 | 4 |
wx/models/report.py | kmarekspartz/wx | 0 | 12789996 | from datetime import datetime
from peewee import ForeignKeyField, DateTimeField
from wx.app import database
from wx.models.station import Station
class Report(database.Model):
station = ForeignKeyField(Station, related_name='reports')
timestamp = DateTimeField(default=datetime.now)
class Meta:
... | 2.296875 | 2 |
tests/artifacts/drivers/simple_hello/http_rest_helper.py | SergeyKanzhelev/anthos-appconfig | 14 | 12789997 | <filename>tests/artifacts/drivers/simple_hello/http_rest_helper.py
#!/usr/bin/python
#
# Copyright 2019 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.o... | 2.53125 | 3 |
firststreet/models/historic.py | owenhw/fsf_api_access_python | 15 | 12789998 | # Author: <NAME> <<EMAIL>>
# Copyright: This module is owned by First Street Foundation
# Internal Imports
from firststreet.models.api import Api
from firststreet.models.geometry import Geometry
class HistoricEvent(Api):
"""Creates a Historic Event object given a response
Args:
response (JSON): A JS... | 2.46875 | 2 |
codes/utilities/gan_tournament_selection.py | roddtalebi/ezCGP | 0 | 12789999 | '''
tournament to rank refiners + discriminators for simgan
'''
import numpy as np
import pandas as pd
import torch
def get_graph_ratings(refiners,
discriminators,
validation_data,
device,
starting_rating=1500,
... | 2.84375 | 3 |
VRPTWObjectiveFunction.py | tweinyan/hsavrptw | 2 | 12790000 | <reponame>tweinyan/hsavrptw
#!/usr/bin/python
"""hsa
Usage:
hsa.py <problem_instance> --hms=<hms> --hmcr=<hmcr> --parmax=<par> --parmin=<parmin> --ni=<ni>
Options:
--hms=<hms> Harmony memory size e.g. 10, 20, 30...
--hmcr=<hmcr> Harmony memory consideration rate e.g. 0.6, 0.7, 0.8
--ni=<ni> ... | 2.578125 | 3 |
bin/ud/__init__.py | cedar101/spaCy | 12 | 12790001 | <filename>bin/ud/__init__.py
from .conll17_ud_eval import main as ud_evaluate # noqa: F401
from .ud_train import main as ud_train # noqa: F401
| 1.132813 | 1 |
cdk/tests/unit/test_config.py | IGVF-DACC/igvfd | 1 | 12790002 | import pytest
def test_config_exists():
from infrastructure.config import config
assert 'demo' in config['environment']
def test_config_common_dataclass():
from infrastructure.config import Common
common = Common()
assert common.organization_name == 'igvf-dacc'
assert common.project_name == ... | 2.125 | 2 |
manim_rubikscube/__init__.py | WampyCakes/manim-rubikscube | 20 | 12790003 | from .cube import *
from .cube_animations import *
try:
import importlib.metadata as importlib_metadata
except ModuleNotFoundError:
import importlib_metadata
__version__ = importlib_metadata.version(__name__)
| 1.132813 | 1 |
homedisplay/info_timers/migrations/0006_auto_20160224_1522.py | ojarva/home-info-display | 1 | 12790004 | <gh_stars>1-10
# -*- coding: utf-8 -*-
# Generated by Django 1.9.2 on 2016-02-24 13:22
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('info_timers', '0005_auto_20160213_1439'),
]
operations = [
mi... | 1.507813 | 2 |
demos/synchronization/synchronization.py | ae6nr/digicomm | 1 | 12790005 | <reponame>ae6nr/digicomm<gh_stars>1-10
#
# Symbol Synchronization
#
# This script tests the efficacy of frequency offset estimators for QPSK and 16-APSK constellations.
# This script does *not* handle phase ambiguity resolution.
#
# QPSK Example
# In this noiseless example, we create a series of symbols using a QPSK co... | 2.421875 | 2 |
checkmate/lib/stats/helpers.py | marcinguy/checkmate-ce | 80 | 12790006 | <filename>checkmate/lib/stats/helpers.py
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
def directory_splitter(path,include_filename = False):
if include_filename:
path_hierarchy = path.split("/")
else:
path_hierarchy = path.split("/")[:-1]
if path.startswith('/'):
... | 2.640625 | 3 |
TunServer.py | mrlinqu/intsa_term_client | 0 | 12790007 | <reponame>mrlinqu/intsa_term_client
# Copyright 2020 by <NAME> <<EMAIL>>.
# All rights reserved.
# This file is part of the Intsa Term Client - X2Go terminal client for Windows,
# and is released under the "MIT License Agreement". Please see the LICENSE
# file that should have been included as part of this package.
im... | 2.109375 | 2 |
auth_app/migrations/0003_auto_20220120_2339.py | Afeez1131/Referral_contest | 0 | 12790008 | # Generated by Django 3.2 on 2022-01-20 21:39
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("auth", "0012_alter_user_first_name_max_length"),
("auth_app", "0002_businessowner_is_superuser"),
]
operations = [
migrations.AddField... | 1.953125 | 2 |
tests/test_dixday_predictions.py | innovation-hub-bergisches-rheinland/dixday-predictions | 0 | 12790009 | import csv
import yaml
from dixday_predictions import __version__
from dixday_predictions.eventhandler.EventHandler import EventHandler
def _read_config(config_path) -> dict:
with open(config_path, "r") as ymlfile:
config = yaml.safe_load(ymlfile)
return config
def test_version():
assert __vers... | 2.125 | 2 |
helpers/db_helpers.py | zoltancsontos/pystack-framework | 0 | 12790010 | <filename>helpers/db_helpers.py
import os
import re
env = os.environ
class DbHelpers(object):
"""
Database helpers
:author: <EMAIL>
"""
@staticmethod
def __get_connection_parts__(connection_string, ):
conn_str = env['CLEARDB_DATABASE_URL']
db_type, user, password, host, databa... | 2.65625 | 3 |
genpairs.py | TestCreator/GenPairs | 0 | 12790011 | # Generate an all-pairs covering test suite
#
# (c) 2007 University of Oregon and <NAME>
# All rights reserved.
#
License = """
(C) 2007,2017 University of Oregon and <NAME>. All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the followi... | 1.328125 | 1 |
src/main/python/mydiscordbot.py | mgaertne/minqlx-plugin-tests | 4 | 12790012 | <filename>src/main/python/mydiscordbot.py
"""
This is a plugin created by ShiN0
Copyright (c) 2017 ShiN0
<https://www.github.com/mgaertne/minqlx-plugin-tests>
You are free to modify this plugin to your own one, except for the version command related code.
The basic ideas for this plugin came from Gelenkbusfahrer and ... | 2.546875 | 3 |
coh_wn_read.py | Renata1995/Topic-Distance-and-Coherence | 5 | 12790013 | <reponame>Renata1995/Topic-Distance-and-Coherence<gh_stars>1-10
from coherence.wn import WordNetEvaluator
import sys
import utils.name_convention as name
from topic.topicio import TopicIO
from nltk.corpus import wordnet as wn
from nltk.corpus import reuters
import os
#
# syntax: python coh_wn_read.py <corpus type> <#... | 2.625 | 3 |
Advent2018/15.py | SSteve/AdventOfCode | 0 | 12790014 | from dataclasses import dataclass
from typing import List, NamedTuple
import numpy as np
from generic_search import bfsCave, nodeToPath
wall = "#"
emptySpace = "."
class GridLocation(NamedTuple):
column: int
row: int
def __lt__(self, other):
return self.row < other.row or \
self.row... | 3.53125 | 4 |
tourney/constants.py | seangeggie/tourney | 0 | 12790015 | from datetime import time, timedelta
# Will print all read events to stdout.
DEBUG = False
DATA_PATH = "~/.tourney"
CHANNEL_NAME = "foosball"
RTM_READ_DELAY = 0.5 # seconds
RECONNECT_DELAY = 5.0 # seconds
COMMAND_REGEX = "!(\\w+)\\s*(.*)"
REACTION_REGEX = ":(.+):"
SCORE_ARGS_REGEX = "(T\\d+)\\s+(\\d+)\\s+(T\\d+)\\s... | 2.3125 | 2 |
proj01_ifelse/proj01.py | tristank23/vsa2018- | 0 | 12790016 | # Name:
# Date:
# proj01: A Simple Program
# Part I:
# This program asks the user for his/her name and grade.
#Then, it prints out a sentence that says the number of years until they graduate.
#var name
user_name = raw_input("Enter your name: ")
# user_grade = raw_input("Enter your grade: ")
# grad_year = 12 - int(us... | 4.34375 | 4 |
main.py | vtlanglois/01-Interactive-Fiction | 0 | 12790017 | <filename>main.py
#!/usr/bin/env python3
import sys
import json
import os
assert sys.version_info >= (3,9), "This script requires at least Python 3.9"
# ----------------------------------------------------------------
def select_game():
#Get all json filenames within the json folder
path_to_json_files = "json/"
... | 3.546875 | 4 |
src/sst/elements/ember/test/generateNidListRange.py | sudhanshu2/sst-elements | 58 | 12790018 | def generate( args ):
args = args.split(',')
start = int(args[0])
length = int(args[1])
#print 'generate', start, length
return str(start) + '-' + str( start + length - 1 )
| 3.640625 | 4 |
l2.py | Ebony-Ayers/awmms | 0 | 12790019 | import math
for i in range(1, 25):
r = math.floor(math.log2(i))
#j = i
#counter = 0
#while j != 1:
# j >>= 1
# counter += 1
j = i
counter = 0
while j >>= 1:
j >>= 1
counter += 1
print(f"{i:2} {bin(i)[2:]:>5} {r} {counter}")
| 3.203125 | 3 |
setup.py | mtskelton/django-simple-export | 0 | 12790020 | <filename>setup.py
from distutils.core import setup
setup(name='django-simple-export',
version='0.1',
license='BSD',
packages=['simple_export'],
include_package_data=True,
description='Simple import / export utility for Django with large data support. Compatible with Mongoengine.',
... | 1.070313 | 1 |
mouseInteractive.py | wwwins/OpenCV-Samples | 0 | 12790021 | # -*- coding: utf-8 -*-
import cv2
import sys
import numpy as np
import argparse
imagePath = "img.png"
sx = sy = None
previewImage = None
if len(sys.argv) < 3:
print("""
Usage:
python mouseInteractive -i img.png
""")
sys.exit(-1)
if sys.argv[1]=="-i":
imagePath = sys.argv[2]
def cre... | 3.078125 | 3 |
images.py | malyvsen/marble | 1 | 12790022 | <filename>images.py
#%% imports
#% matplotlib inline
import skimage
import matplotlib.pyplot as plt
import numpy as np
from imgaug import augmenters as iaa
from imageio import mimsave
#%% loading
def to_rgb(image):
if len(np.shape(image)) == 2:
return skimage.color.gray2rgb(image)
return image[:, :, :... | 2.40625 | 2 |
neptune/internal/channels/channels.py | wuchangsheng951/neptune-client | 0 | 12790023 | #
# Copyright (c) 2019, Neptune Labs Sp. z o.o.
#
# 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 agr... | 2.3125 | 2 |
plusminus/examples/dice_roll_parser.py | ptmcg/arithmetic_parsing | 0 | 12790024 | #
# dice_roll_parser.py
#
# Copyright 2021, <NAME>
#
from plusminus import BaseArithmeticParser
# fmt: off
class DiceRollParser(BaseArithmeticParser):
"""
Parser for evaluating expressions representing rolls of dice, as used in many board and
role-playing games, such as:
d20
3d20
... | 3.328125 | 3 |
book/ch02/python/ch02.py | verazuo/Code-For-Data-driven-Security | 0 | 12790025 | <reponame>verazuo/Code-For-Data-driven-Security
#
# name ch02.py
# 数据帧(类似excel)
# create a new data frame
import numpy as np
import pandas as pd
# create a new data frame of hosts & high vuln counts
assets_df = pd.DataFrame({
"name": ["danube", "gander", "ganges", "mekong", "orinoco"],
"os": ["W2K8", "RHEL5"... | 3.390625 | 3 |
aiocometd_chat_demo/cometd.py | robertmrk/aiocometd-chat-demo | 1 | 12790026 | """Synchronous CometD client"""
from enum import IntEnum, unique, auto
import asyncio
from functools import partial
from typing import Optional, Iterable, TypeVar, Awaitable, Callable, Any
import concurrent.futures as futures
from contextlib import suppress
import aiocometd
from aiocometd.typing import JsonObject
# py... | 2.5 | 2 |
YAuB/app.py | Wyvryn/YAuB | 0 | 12790027 | <reponame>Wyvryn/YAuB
"""
Main webapp logic
All setup config and endpoint definitions are stored here
.. TODO:: allow user creation
.. TODO:: page to show loaded plugins
"""
from dateutil import parser
import models
from flask import Blueprint, flash, redirect, render_template, request, url_for
from flask.ext.logi... | 2.078125 | 2 |
Codes/PC-Interface/erts.py | eyantra/Border_Surveillance_Robot_using_Firebird_ATmega2560 | 1 | 12790028 | """**************************************************************************************************
Platform: Python 2.x and 2.x.x
Title: Border Surveillance Bot
Author:
1.<NAME>
2.<NAME>
**************************************************************************************************/
/***************... | 1.351563 | 1 |
hubbot/moduleinterface.py | HubbeKing/Hubbot_Twisted | 2 | 12790029 | from enum import Enum
class ModuleAccessLevel(Enum):
ANYONE = 0
ADMINS = 1
class ModuleInterface(object):
"""
The interface modules should inherit and implement in order to function with the ModuleHandler.
triggers - command words that cause the module to trigger.
accepted_types - message t... | 3.1875 | 3 |
gui_res/game_window.py | CoderTofu/Match-A-Card | 0 | 12790030 | <filename>gui_res/game_window.py
from tkinter import *
import threading
import time
import random
from gui_res.gui_frames.card_frame import card_frame
def game_gui(window, count, deck):
"""
Takes in the original window, count selected, and deck generated.
Creates a new window with the 3 params
"""
... | 3.71875 | 4 |
pychess/Players/ProtocolEngine.py | jacobchrismarsh/chess_senior_project | 0 | 12790031 | from gi.repository import GObject
from pychess.Players.Engine import Engine
from pychess.Utils.const import NORMAL, ANALYZING, INVERSE_ANALYZING
TIME_OUT_SECOND = 60
class ProtocolEngine(Engine):
__gsignals__ = {
"readyForOptions": (GObject.SignalFlags.RUN_FIRST, None, ()),
"readyForMoves": (GO... | 2.265625 | 2 |
espy/algorithms/channel_noise_simulator.py | Yomikron/espy | 1 | 12790032 | import numpy
class channel_noise_simulator:
"""Class to hold usefull funktions to simulate noise in a channel"""
def __init__(self):
return
# _____________create bits___________________
def create_random_bits_list(self, len):
"""create a random len bits long bitstring """
bi... | 3.53125 | 4 |
tests/observatory/platform/cli/test_click_utils.py | The-Academic-Observatory/observatory-platform | 9 | 12790033 | # Copyright 2020 Curtin University
#
# 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 writi... | 2.796875 | 3 |
kopf/structs/filters.py | yashbhutwala/kopf | 0 | 12790034 | def match(handler, body, changed_fields=None):
return (
(not handler.field or _matches_field(handler, changed_fields or [])) and
(not handler.labels or _matches_labels(handler, body)) and
(not handler.annotations or _matches_annotations(handler, body))
)
def _matches_field(handler, cha... | 2.546875 | 3 |
matasano/t/test_blocks.py | JohnnyPeng18/MatasanoCrypto | 2 | 12790035 | #!/usr/bin/env/ python
# encoding: utf-8
"""
Test block crypto.
"""
import unittest
import matasano.blocks
import matasano.util
__author__ = 'aldur'
class BlocksTestCase(unittest.TestCase):
def test_split_blocks(self):
f = matasano.blocks.split_blocks
b = "this is a test".encode("ascii")
... | 3.34375 | 3 |
dragonkeeper/utils.py | chriskr/dragonkeeper | 5 | 12790036 | import re
from common import Singleton
from maps import status_map, format_type_map, message_type_map, message_map
def _parse_json(msg):
payload = None
try:
payload = eval(msg.replace(",null", ",None"))
except:
print "failed evaling message in parse_json"
return payload
try... | 2.53125 | 3 |
preprocesamiento/artists_track_extract.py | MINE4201grupo2/sr_taller_1 | 0 | 12790037 | import pandas as pd
import mysql.connector
from mysql.connector import errorcode
import math
import sys
import csv
#Configuración de la conexión a Mysql
try:
cnx = mysql.connector.connect(user='user_taller1', password='<PASSWORD>.', host='127.0.0.1', database='taller1')
except mysql.connector.Error as err:
if err.... | 2.765625 | 3 |
dogqc/querylib.py | cakebytheoceanLuo/dogqc | 12 | 12790038 | from dogqc.code import Code
# includes
def getIncludes ():
code = Code()
code.add("#include <list>")
code.add("#include <unordered_map>")
code.add("#include <vector>")
code.add("#include <iostream>")
code.add("#include <ctime>")
code.add("#include <limits.h>")
code.add("#include <float.... | 2.234375 | 2 |
ciservice/apiv1/resource_upload.py | idekerlab/ci-service-template | 2 | 12790039 | # -*- coding: utf-8 -*-
import logging
import requests as rqc
from flask.ext.restful import Resource
from flask import Response, request
from flask import stream_with_context
INPUT_DATA_SERVER_LOCATION = 'http://dataserver:3000/'
class UploadResource(Resource):
def get(self):
req = rqc.get(INPUT_DATA_SE... | 2.515625 | 3 |
fluent_comments/tests/test_utils.py | ephes/django-fluent-comments | 88 | 12790040 | <filename>fluent_comments/tests/test_utils.py
from django.test import SimpleTestCase
from fluent_comments.utils import split_words
class TestUtils(SimpleTestCase):
def test_split_words(self):
text = """college scholarship essays - <a href=" https://collegeessays.us/ ">how to write a good introduction for... | 2.859375 | 3 |
TLA/Data/get_data.py | tusharsarkar3/TLA | 50 | 12790041 | <filename>TLA/Data/get_data.py
from TLA.Data.get_tweets import get_data_for_lang
from TLA.Data.Pre_Process_Tweets import pre_process_tweet
import os
import pandas as pd
import argparse
from distutils.sysconfig import get_python_lib
def store_data(language, process = False):
"""
Cretaes a .csv file for the lan... | 2.96875 | 3 |
api/tacticalrmm/scripts/models.py | HighTech-Grace-Solutions/tacticalrmm | 0 | 12790042 | <gh_stars>0
import base64
import re
from loguru import logger
from typing import Any, List, Union
from django.conf import settings
from django.contrib.postgres.fields import ArrayField
from django.db import models
from logs.models import BaseAuditModel
SCRIPT_SHELLS = [
("powershell", "Powershell"),
("cmd", "... | 2 | 2 |
Lib/site-packages/pylint/message/__init__.py | edupyter/EDUPYTER38 | 0 | 12790043 | <gh_stars>0
# Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE
# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt
"""All the classes related to Message handling."""
from pylint.message.message import... | 1.570313 | 2 |
other_baselines_scripts/run_mendelian_experiments_more_baselines.py | carolineyuchen/MMRIV | 2 | 12790044 | import torch, add_path
import numpy as np
from baselines.all_baselines import Poly2SLS, Vanilla2SLS, DirectNN, \
GMM, DeepIV, AGMM
import os
import tensorflow
from MMR_IVs.util import ROOT_PATH, load_data
import random
random.seed(527)
def eval_model(model, test):
g_pred_test = model.predict(test.x)
mse = ... | 2.046875 | 2 |
webservices/common/models/costs.py | 18F/openFEC | 246 | 12790045 | from sqlalchemy.dialects.postgresql import TSVECTOR
from .base import db
class CommunicationCost(db.Model):
__tablename__ = 'ofec_communication_cost_mv'
sub_id = db.Column(db.Integer, primary_key=True)
original_sub_id = db.Column('orig_sub_id', db.Integer, index=True)
candidate_id = db.Column('cand_... | 2.203125 | 2 |
mars/tensor/reduction/__init__.py | sighingnow/mars | 0 | 12790046 | <reponame>sighingnow/mars<filename>mars/tensor/reduction/__init__.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright 1999-2018 Alibaba Group Holding Ltd.
#
# 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 co... | 1.570313 | 2 |
plugins/status.py | DasFranck/ConDeBot_Discord | 0 | 12790047 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
import discord
from classes.Plugin import Plugin
NAME = "Status"
DESCRIPTION = "Change the bot status and his played game on discord"
USAGE = {}
class StatusPlugin(Plugin):
def __init__(self, cdb):
super().__init__(cdb)
self.status_dict = {"online... | 2.78125 | 3 |
sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2016_09_01/models/__init__.py | vbarbaresi/azure-sdk-for-python | 8 | 12790048 | <reponame>vbarbaresi/azure-sdk-for-python<gh_stars>1-10
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated ... | 1.476563 | 1 |
salt-2016.3.3/tests/unit/states/glusterfs_test.py | stephane-martin/salt-debian-packaging | 0 | 12790049 | <reponame>stephane-martin/salt-debian-packaging<gh_stars>0
# -*- coding: utf-8 -*-
'''
:codeauthor: :email:`<NAME> <<EMAIL>>`
'''
# Import Python libs
from __future__ import absolute_import
# Import Salt Testing Libs
from salttesting import skipIf, TestCase
from salttesting.mock import (
NO_MOCK,
NO_MOCK_R... | 1.804688 | 2 |
src/qa4sm_reader/plotter.py | sheenaze/qa4sm-reader | 0 | 12790050 | <gh_stars>0
# -*- coding: utf-8 -*-
from pathlib import Path
import seaborn as sns
import pandas as pd
from qa4sm_reader.img import QA4SMImg
import qa4sm_reader.globals as globals
from qa4sm_reader.plot_utils import *
from warnings import warn
class QA4SMPlotter():
"""
Class to create image files of plots f... | 2.296875 | 2 |