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 |
|---|---|---|---|---|---|---|
slack_sdk/scim/v1/user.py | priya1puresoftware/python-slack-sdk | 2,486 | 36700 | <filename>slack_sdk/scim/v1/user.py
from typing import Optional, Any, List, Dict, Union
from .default_arg import DefaultArg, NotGiven
from .internal_utils import _to_dict_without_not_given, _is_iterable
from .types import TypeAndValue
class UserAddress:
country: Union[Optional[str], DefaultArg]
locality: Uni... | 2.140625 | 2 |
typhoon/core/glue.py | typhoon-data-org/typhoon-orchestrator | 21 | 36701 | """Contains code that stitches together different parts of the library. By containing most side effects here the rest
of the code can be more deterministic and testable.
This code should not be unit tested.
"""
import os
from pathlib import Path
from typing import Union, List, Tuple, Dict, Optional
import yaml
from py... | 2.25 | 2 |
pqu/Check/check.py | brown170/fudge | 14 | 36702 | <filename>pqu/Check/check.py
# <<BEGIN-copyright>>
# Copyright 2021, Lawrence Livermore National Security, LLC.
# See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: BSD-3-Clause
# <<END-copyright>>
import sys
import glob, os, shutil, filecmp
PYTHON = sys.executable
files = sorted( glob.glob(... | 2.359375 | 2 |
config.py | nicfro/brownian_motion | 0 | 36703 | settings = {"velocity_min": 1,
"velocity_max": 3,
"x_boundary": 800,
"y_boundary": 800,
"small_particle_radius": 5,
"big_particle_radius": 10,
"number_of_particles": 500,
"density_min": 2,
"density_max": 20
} | 1.0625 | 1 |
hooks_plugins/hooks_mail_plugin/mail_plugin.py | crawlino/crawlino-plugins | 2 | 36704 | <filename>hooks_plugins/hooks_mail_plugin/mail_plugin.py
import logging
import smtplib
from crawlino import hook_plugin, PluginReturnedData, CrawlinoValueError
log = logging.getLogger("crawlino-plugin")
@hook_plugin
def hook_mail(prev_step: PluginReturnedData, **kwargs):
log.debug("Hooks Module :: mail plugin")... | 2.234375 | 2 |
app/model/message.py | godraadam/privy-router | 0 | 36705 | <reponame>godraadam/privy-router
from pydantic import BaseModel
class PrivyMessage(BaseModel):
recipient_alias: str # alias of recipient
message: str # the message
| 2.046875 | 2 |
src/fedActionFromTargetRate.py | jrrpanix/ML9 | 0 | 36706 | import os
import csv
import glob
import numpy as np
import pandas as pd
import nltk
import string
import re
from numpy import genfromtxt
from nltk import *
from nltk.corpus.reader.plaintext import PlaintextCorpusReader
from nltk import word_tokenize
from nltk.util import ngrams
from collections import Counter
def sta... | 2.765625 | 3 |
wk/cv/utils/__init__.py | Peiiii/wk | 0 | 36707 | <filename>wk/cv/utils/__init__.py
from .imutils import *
from .boxutils import *
| 1.0625 | 1 |
PDF-Tools/main.py | Aayush-hub/Amazing-Python-Scripts | 3 | 36708 | <reponame>Aayush-hub/Amazing-Python-Scripts
import os
from PyPDF2 import PdfFileReader, PdfFileWriter
def merge_pdfs():
''' Merge multiple PDF's into one combined PDF '''
input_paths = input(r"Enter comma separated list of paths to the PDFs ")
paths = input_paths.split(',')
pdf_file_writer = PdfFileW... | 3.8125 | 4 |
tech.py | ajul/galciv3wikiscripts | 0 | 36709 | <gh_stars>0
import xml.etree.ElementTree as ET
import re
import os
import loc
datadir = 'D:/Steam/steamapps/common/Galactic Civilizations III/data'
gamedatadir = os.path.join(datadir, 'Game')
def processTechTree(techList, filename):
filebase, _ = os.path.splitext(filename)
techSpecializationList = ET.parse(os... | 2.6875 | 3 |
matching/CopingWithOutlier.py | HeCraneChen/3D-Crowd-Pose-Estimation-Based-on-MVG | 35 | 36710 | <filename>matching/CopingWithOutlier.py<gh_stars>10-100
import sys
import json
import os
import numpy as np
from scipy.optimize import linear_sum_assignment
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import axes3d, Axes3D
import cv2
import pylab as pl
from numpy import linalg as LA
import random
import m... | 2.34375 | 2 |
tests/test_workspace.py | rossumai/rossumctl | 0 | 36711 | <reponame>rossumai/rossumctl
import re
from functools import partial
from traceback import print_tb
import pytest
from more_itertools import ilen
from rossum.workspace import create_command, list_command, delete_command, change_command
from tests.conftest import (
TOKEN,
match_uploaded_json,
ORGANIZATIONS... | 2.09375 | 2 |
mesonconf.py | objectx/meson | 0 | 36712 | <reponame>objectx/meson
#!/usr/bin/env python3
# Copyright 2014 The Meson development team
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
#... | 2.15625 | 2 |
code/plot_harmonic_number.py | nagaokayuji/workshop-complexity | 0 | 36713 | import matplotlib.pyplot as plt
import numpy as np
def count_harmonic_numbers(n: int):
count = 0
for i in range(1, n+1): # 1 ~ N まで
for _ in range(i, n+1, i): # N以下の i の倍数
count += 1
return count
x = np.linspace(1, 10**5, 100, dtype='int')
y = list(map(lambda x: count_harmonic_numb... | 3.734375 | 4 |
stockviewer/stockviewer/source/websource.py | vyacheslav-bezborodov/skt | 0 | 36714 | <reponame>vyacheslav-bezborodov/skt
import logging
import csv
from urllib2 import urlopen, quote
from datetime import datetime
from stockviewer.utils import make_timedelta, make_fields
class websource():
def __init__(self, config):
logging.debug('Web source init: config {}'.format(config))
self.__config = confi... | 2.40625 | 2 |
backdriveb2/api/objects/__init__.py | Joffreybvn/backdriveb2 | 0 | 36715 | <reponame>Joffreybvn/backdriveb2<gh_stars>0
from .account import Account
from .bucket import Bucket
__all__ = ["Account", "Bucket"]
| 1.34375 | 1 |
src/utilities/helpers/predict.py | szymonmaszke/UniFirstKaggle | 2 | 36716 | import pathlib
import numpy as np
def create_submission(path: pathlib.Path, predictions):
pred_with_id = np.stack([np.arange(len(predictions)), predictions], axis=1)
np.savetxt(
fname=path,
X=pred_with_id,
fmt="%d",
delimiter=",",
header="id,label",
comments=""... | 2.265625 | 2 |
pipeline.py | hodleth/bestcondor | 5 | 36717 | import json
import urllib
import utils as ut
from distutils.util import strtobool
class Call(object):
"""docstring for Call"""
def __init__(self, currentStrike, currentPrice, currentProbOTM, currentIV, currentITM):
self.currentStrike = currentStrike
self.currentPrice = currentPrice
self.currentProbOTM = curr... | 2.75 | 3 |
setup.py | rickie/hopla | 0 | 36718 | <gh_stars>0
"""
Module used for building hopla.
[quote](https://setuptools.readthedocs.io/en/latest/setuptools.html):
As PEP 517 is new, support is not universal, and frontends that do
support it may still have bugs. For compatibility, you may want to
put a setup.py file containing only a setuptools.setup() invocation... | 0.851563 | 1 |
pkgs/statsmodels-0.6.1-np110py27_0/lib/python2.7/site-packages/statsmodels/regression/tests/tests_predict.py | wangyum/anaconda | 1 | 36719 | # -*- coding: utf-8 -*-
"""
Created on Sun Apr 20 17:12:53 2014
author: <NAME>
"""
import numpy as np
from statsmodels.regression.linear_model import OLS, WLS
from statsmodels.sandbox.regression.predstd import wls_prediction_std
def test_predict_se():
# this test doesn't use reference values
# checks conis... | 2.234375 | 2 |
Lib/Similarity/Jaccard.py | allanbatista/search_engine | 1 | 36720 | <gh_stars>1-10
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import numpy as np
import json
from Tools.Logger import logger
from Lib.Similarity.Similarity import Similarity
class Jaccard(Similarity):
def predict(self, doc):
results = []
for index in range(self.total):
x = self.X[in... | 2.546875 | 3 |
src/sequencer.py | Azure/DiskInfo | 4 | 36721 | <gh_stars>1-10
"""
Copyright (c) Microsoft Corporation
"""
import sys
import time
import logging
from argparse import ArgumentParser
from .constants import *
from .discovery import *
from .nvme import storeNVMeDevice
from .ata import storeATADevice
from .datahandle import outpu... | 2.375 | 2 |
Ekeopara_Praise/Phase 2/STRINGS/Day32 Tasks/Task8.py | CodedLadiesInnovateTech/-python-challenge-solutions | 6 | 36722 | '''8. Write a Python program to count occurrences of a substring in a string.'''
def count_word_in_string(string1, substring2):
return string1.count(substring2)
print(count_word_in_string('The quick brown fox jumps over the lazy dog that is chasing the fox.', "fox")) | 4.15625 | 4 |
minilabs/test-hypothesis-by-simulating-statistics/m7_l1_tests/q2.py | ebaccay/inferentialthinking | 1 | 36723 | <gh_stars>1-10
test = {
"name": "q2",
"points": 1,
"hidden": True,
"suites": [
{
"cases": [
{
"code": r"""
>>> sample_population(test_results).num_rows
3000
""",
"hidden": False,
"locked": False,
},
{
"code": r"""
>>> "Test Result" in sample_population(tes... | 1.898438 | 2 |
yadage/handlers/predicate_handlers.py | vvolkl/yadage | 0 | 36724 | import logging
import jsonpointer
import yadage.handlers.utils as utils
from yadage.handlers.expression_handlers import handlers as exprhandlers
log = logging.getLogger(__name__)
handlers, predicate = utils.handler_decorator()
def checkmeta(flowview, metainfo):
log.debug('checking meta %s on view with offset ... | 2.28125 | 2 |
spark/DataFormat/Parquet_Example.py | pradeep-charism/nus-mtech-workshops | 0 | 36725 | from pyspark.sql import SparkSession
spark = SparkSession.builder.master("local").appName('ReadParquet').config("spark.driver.host", "localhost").config(
"spark.ui.port", "4040").getOrCreate()
peopleDF = spark.read.json("people.json")
# DataFrames can be saved as Parquet files, maintaining the schema information... | 3.796875 | 4 |
async_pokepy/types/ability.py | PendragonLore/async_pokepy | 5 | 36726 | # -*- coding: utf-8 -*-
"""
The MIT License (MIT)
Copyright (c) 2019 Lorenzo
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, ... | 2.171875 | 2 |
compose/metrics/client.py | galeksandrp/compose | 2 | 36727 | import os
from enum import Enum
import requests
from docker import ContextAPI
from docker.transport import UnixHTTPAdapter
from compose.const import IS_WINDOWS_PLATFORM
if IS_WINDOWS_PLATFORM:
from docker.transport import NpipeHTTPAdapter
class Status(Enum):
SUCCESS = "success"
FAILURE = "failure"
... | 2.328125 | 2 |
chapter17/full_system/plot_accel_debug_pitch_and_roll.py | dannystaple/Learn-Robotics-Programming-Second-Edition | 19 | 36728 | <reponame>dannystaple/Learn-Robotics-Programming-Second-Edition
import vpython as vp
import logging
import time
from robot_imu import RobotImu
logging.basicConfig(level=logging.INFO)
imu = RobotImu()
pr = vp.graph(xmin=0, xmax=60, scroll=True)
graph_pitch = vp.gcurve(color=vp.color.red, graph=pr)
graph_roll = vp.gcu... | 3.03125 | 3 |
sql/sql_tuning.py | bbotte/archery-sql-platfrom | 2 | 36729 | # -*- coding: UTF-8 -*-
import time
import simplejson as json
from MySQLdb.connections import numeric_part
from django.contrib.auth.decorators import permission_required
from django.http import HttpResponse
from common.utils.extend_json_encoder import ExtendJSONEncoder
from common.utils.const import SQLTuning
from s... | 1.9375 | 2 |
LeetCode/Array and Strings/20. Valid Parentheses/solution.py | Ceruleanacg/Crack-Interview | 17 | 36730 | <reponame>Ceruleanacg/Crack-Interview<filename>LeetCode/Array and Strings/20. Valid Parentheses/solution.py<gh_stars>10-100
class Solution:
def isValid(self, s):
"""
:type s: str
:rtype: bool
"""
if not s:
return True
stack = []
for char in s:
... | 3.59375 | 4 |
problems/g1_single/Alpha.py | cprudhom/pycsp3 | 28 | 36731 | <filename>problems/g1_single/Alpha.py
"""
Well-known crypto-arithmetic puzzle of unknown origin (e.g., a model is present in Gecode)
Examples of Execution:
python3 Alpha.py
python3 Alpha.py -variant=var
"""
from pycsp3 import *
if not variant():
def of(word):
return [x[i] for i in alphabet_positions(... | 3.078125 | 3 |
2020/day_16/day_16.py | viddrobnic/adventofcode | 0 | 36732 | <gh_stars>0
def read_data():
rules = dict()
your_ticket = None
nearby_tickets = []
state = 0
with open('in') as f:
for line in map(lambda x: x.strip(), f.readlines()):
if line == '':
state += 1
continue
if line == 'your ticket:':
... | 3.140625 | 3 |
confdgnmi/tests/test_client_server_api.py | micnovak/ConfD-Demos | 11 | 36733 | <reponame>micnovak/ConfD-Demos<filename>confdgnmi/tests/test_client_server_api.py
import socket
import threading
from time import sleep
import pytest
import gnmi_pb2
from client_server_test_base import GrpcBase
from confd_gnmi_api_adapter import GnmiConfDApiServerAdapter
from confd_gnmi_common import make_gnmi_path, ... | 1.914063 | 2 |
Final_Version/FingerFinder.py | jaronoff97/mirrorpi | 0 | 36734 | <filename>Final_Version/FingerFinder.py
import numpy as np
import cv2
import math
class FingerFinder(object):
"""docstring for FingerFinder"""
def __init__(self, background_reduction=False):
super(FingerFinder, self).__init__()
self.bg_reduction = background_reduction
self.kernel = cv... | 2.609375 | 3 |
inventory/admin.py | Riphiphip/website | 0 | 36735 | from django.contrib import admin
from .models import Item
@admin.register(Item)
class ItemAdmin(admin.ModelAdmin):
fieldsets = [
('Item', {
'fields': [
'name',
'stock',
'description',
'thumbnail'
]
}),
(... | 1.6875 | 2 |
HubblePi/Toolbox.py | scriptorron/hubblepi | 0 | 36736 | <reponame>scriptorron/hubblepi
import numpy as np
import json
import colour_demosaicing
def LoadRaw(FN):
"""
DEPRECATED!
load and unpack RAW image
:params FN: file name
"""
data = np.load(FN)
shape = data.shape
if shape == (1944, 3240):
CameraType = 1
elif shape == (2464, 4... | 2.765625 | 3 |
src/backend/autoencoder_evaluate.py | framtale/image-retrieval | 0 | 36737 | <gh_stars>0
from numpy.core.defchararray import array
from tensorflow.keras.models import Model
from tensorflow.keras.models import load_model
from tensorflow.keras.datasets import mnist
from PIL import Image
from tqdm import tqdm
import matplotlib.pyplot as plt
import statistics
import numpy as np
import pickle
import... | 2.5625 | 3 |
a4plot/python/rooplot/stacks/stacks.py | a4/a4 | 4 | 36738 | from ROOT import gROOT, gStyle, Double
from ROOT import TLegend, TLatex, TCanvas, THStack, TLine, TBox
from ROOT import kYellow, kBlack, kWhite, kRed, kWhite, kOrange
import os
import random
from colors import set_color_1D, set_color_2D, set_data_style, set_MCTotal_style, set_signal_style_1D
tsize = 0.06
tyoffset = ... | 2.078125 | 2 |
test/pldi19/run_all.py | tjknoth/resyn | 19 | 36739 | #!/usr/bin/python3
import sys
import os, os.path
import platform
import shutil
import time
import re
import difflib
import pickle
from subprocess import run, PIPE
from colorama import init, Fore, Back, Style
from statistics import median
# Globals
if platform.system() in ['Linux', 'Darwin']:
SYNQUID_CMD = ['stack'... | 2.015625 | 2 |
plantcv/plantcv/hist_equalization.py | Howzit123/plantcv | 2 | 36740 | <filename>plantcv/plantcv/hist_equalization.py
# Histogram equalization
import cv2
import numpy as np
import os
from plantcv.plantcv import print_image
from plantcv.plantcv import plot_image
from plantcv.plantcv import fatal_error
from plantcv.plantcv import params
def hist_equalization(gray_img):
"""Histogram e... | 3.265625 | 3 |
ehub/conftest.py | teofiln/ehub | 0 | 36741 | <reponame>teofiln/ehub
import pytest
from ehub.users.models import User
from ehub.users.tests.factories import UserFactory
@pytest.fixture(autouse=True)
def media_storage(settings, tmpdir):
settings.MEDIA_ROOT = tmpdir.strpath
@pytest.fixture
def user() -> User:
return UserFactory()
| 1.78125 | 2 |
Sort/Merge.py | sywh/algorithms | 0 | 36742 | from Sort.Example import Example
class Merge(Example):
def __init__(self) -> None:
super().__init__()
def sort(self, a):
# create aux just once
self.aux = [None for i in range(len(a))]
self._sort(a, 0, len(a) - 1)
def _sort(self, a, lo, hi):
if lo >= hi:
... | 3.78125 | 4 |
crowdsourcing/permissions/user.py | Kyeongan/crowdsource-platform | 138 | 36743 | <reponame>Kyeongan/crowdsource-platform
from rest_framework import permissions
from csp import settings
from rest_framework.exceptions import PermissionDenied
class IsWorker(permissions.BasePermission):
def has_permission(self, request, view):
return request.user.profile.is_worker
class IsRequester(perm... | 2.359375 | 2 |
web/setup.py | ISTU-Labs/pt-2271-2018 | 0 | 36744 | <filename>web/setup.py
from setuptools import setup
requires = [
'pyramid',
'waitress',
'python-dateutil'
]
setup(name='hello',
install_requires=requires,
package_dir={'': "hello"},
entry_points="""\
[paste.app_factory]
main = hello:main
""",
)
| 1.476563 | 1 |
main.py | trollerfreak331/pornhub-pluenderer | 12 | 36745 | import sys
import signal
from clint.textui import colored, puts
from downloader import Downloader
from extractor import Extractor
signal.signal(signal.SIGINT, lambda x, y: sys.exit(0))
def main():
downloader = Downloader()
extractor = Extractor()
url = "https://pornhub.com"
puts(colored.green("getti... | 2.71875 | 3 |
dankbindings.py | actualdankcoder/erindashboard | 1 | 36746 | from cryptography.fernet import Fernet
import os
import discord
import aiohttp
import secrets
from urllib.parse import quote
from dotenv import load_dotenv
load_dotenv()
class OAuth:
def __init__(self):
# User Provided Data
self.client_id = os.getenv("CID")
self.client_secret = os.getenv("C... | 3.03125 | 3 |
ryu/ryu/app/Ryuretic/Ryuretic_Intf_v6.py | Ryuretic/RAP | 2 | 36747 | <reponame>Ryuretic/RAP<filename>ryu/ryu/app/Ryuretic/Ryuretic_Intf_v6.py
#########################################################################
# Ryuretic: A Modular Framework for RYU #
# !/ryu/ryu/app/Ryuretic/Ryuretic_Intf.py #
# Authors: ... | 1.8125 | 2 |
pyPQN/SoftmaxLoss2.py | steveli/mogp | 7 | 36748 | from __future__ import division
import numpy as np
def SoftmaxLoss2(w, X, y, k):
# w(feature*class,1) - weights for last class assumed to be 0
# X(instance,feature)
# y(instance,1)
#
# version of SoftmaxLoss where weights for last class are fixed at 0
# to avoid overparameterization
n, ... | 2.796875 | 3 |
syfertext/string_store.py | socd06/SyferText | 0 | 36749 | from .utils import hash_string
from typing import Union
class StringStore:
"""StringStore object acts as a lookup table.
It looks up strings by 64-bit hashes and vice-versa, looks up hashes by their corresponding strings.
"""
def __init__(self, strings=None):
"""Create the StringStore object
... | 3.859375 | 4 |
notebooks/utils.py | wranda12/06-machine-learning | 1 | 36750 | <gh_stars>1-10
#
# Some functions to be used in the tutorial
#
# Developed by <NAME>
import datetime
import pandas as pd
import matplotlib.pyplot as plt # for 2D plotting
import numpy as np
import seaborn as sns # plot nicely =)
from sklearn.base import clone
from sklearn.decomposition import PCA
from sklearn.model... | 3.328125 | 3 |
vpn-proxy/app/migrations/0005_tunnel_protocol.py | dimrozakis/priv-net | 0 | 36751 | <reponame>dimrozakis/priv-net<gh_stars>0
# -*- coding: utf-8 -*-
# Generated by Django 1.9.7 on 2016-08-01 13:16
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('app', '0004_remove_forwarding_src_addr'),
]
... | 1.53125 | 2 |
t/config_test.py | jrmsdev/rosshm | 0 | 36752 | # Copyright (c) <NAME> <<EMAIL>>
# See LICENSE file.
from os import path
def test_config(testing_config):
with testing_config() as config:
assert config.filename().endswith('rosshm.ini')
assert config.getbool('debug')
with testing_config(init = False):
config.init(fn = None)
assert config.getbool('debug')
... | 2.21875 | 2 |
venv/lib/python3.8/site-packages/IPython/testing/decorators.py | johncollinsai/post-high-frequency-data | 2 | 36753 | <reponame>johncollinsai/post-high-frequency-data
# -*- coding: utf-8 -*-
"""Decorators for labeling test objects.
Decorators that merely return a modified version of the original function
object are straightforward. Decorators that return a new function object need
to use nose.tools.make_decorator(original_function)(... | 2.78125 | 3 |
code/_pth0_only/parameters_compute.py | uq-aibe/spir-oz | 0 | 36754 | <reponame>uq-aibe/spir-oz
#!/usr/bin/env python3
import numpy as np
from parameters import *
from fcn_economic import *
# ================================================================
# Computational parameters
# Ranges for state variables
kap_L = 0.1
kap_U = 10
# Ranges for policy variables
lab_L = 0.1
lab_U = 2
... | 1.898438 | 2 |
src/zc/relation/queryfactory.py | witsch/zc.relation | 0 | 36755 | <reponame>witsch/zc.relation
##############################################################################
#
# Copyright (c) 2006-2008 Zope Foundation and Contributors.
# All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.1 (ZPL). A copy of the ZPL should accom... | 1.945313 | 2 |
radolan_scraper/add_coordinate_grid.py | JarnoRFB/radolan-scraper | 0 | 36756 | <filename>radolan_scraper/add_coordinate_grid.py<gh_stars>0
"""Add the multidimensional coordinates to the netcdf file."""
from pathlib import Path
from typing import *
import h5netcdf
import numpy as np
def main():
base_data_dir = Path(__file__).parents[3] / "data" / "radolan"
metadata_dir = Path(__file__).... | 2.734375 | 3 |
test/test_13_BNetwork_class.py | geolovic/topopy | 5 | 36757 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on 09 february, 2021
Testing suite for BNetwork class
@author: <NAME>
@email: <EMAIL>
@date: 09 february, 2021
"""
import unittest
import os
import numpy as np
from topopy import Flow, Basin, Network, BNetwork, DEM
from topopy.network import NetworkError
infol... | 2.5 | 2 |
modoboa_postfix_autoreply/migrations/0005_auto_20151202_1623.py | modoboa/modoboa-postfix-autoreply | 5 | 36758 | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
def remove_useless_aliases(apps, schema_editor):
"""Remove aliases linked to disabled messages."""
ARmessage = apps.get_model("modoboa_postfix_autoreply", "ARmessage")
AliasRecipient = apps.get_model(... | 1.9375 | 2 |
mhvdb2/models.py | kjnsn/mhvdb2 | 0 | 36759 | <gh_stars>0
from mhvdb2 import database
from peewee import *
class BaseModel(Model):
class Meta:
database = database
class Entity(BaseModel):
"""
An Entity sends money to the organisation or recieves money from the
organistaion. Members are a special type of entity.
"""
is_member = B... | 3.140625 | 3 |
cogs/tags.py | milindmadhukar/Martin-Garrix-Bot | 2 | 36760 | <reponame>milindmadhukar/Martin-Garrix-Bot
from discord.ext import commands
import discord
from aiohttp import request
import asyncio
from .utils.DataBase.tag import Tag
def setup(bot):
bot.add_cog(TagCommands(bot=bot))
class TagCommands(commands.Cog, name="Tags"):
def __init__(self, bot):
... | 2.671875 | 3 |
trainer.py | 97chenxa/Multiview2Novelview | 1 | 36761 | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from six.moves import xrange
from util import log
from pprint import pprint
from input_ops import create_input_ops
from model import Model
import os
import time
import tensorflow as tf
import tensorflow.contr... | 2 | 2 |
pyprof/examples/apex/fused_layer_norm.py | yhgon/PyProf | 0 | 36762 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Copyright (c) 2020, NVIDIA CORPORATION. All rights reserved.
#
# 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/li... | 1.984375 | 2 |
twitter/forms.py | isulim/twitter | 0 | 36763 | <reponame>isulim/twitter<gh_stars>0
from django import forms
from django.contrib.auth.models import User
from django.contrib.auth.forms import UserCreationForm
from twitter import models
class UserRegisterForm(UserCreationForm):
email = forms.EmailField()
class Meta:
model = User
fields = ['... | 2.390625 | 2 |
class-notes/chapter_13/readline_text.py | rhoenkelevra/python_simple_applications | 0 | 36764 | # -*- coding: utf-8 -*-
"""
Created on Mon Jul 26 15:06:57 2021
@author: user24
"""
file = "./data/tsuretsuregusa.txt"
with open(file, "r", encoding="utf_8") as fileobj:
while True:
# set line as value of the file line
line = fileobj.readline()
# removes any white space at the end of strin... | 3.609375 | 4 |
appendix_a_comments/reading_comments.py | r00c/automating_excel_with_python | 43 | 36765 | <reponame>r00c/automating_excel_with_python
# reading_comments.py
from openpyxl import load_workbook
from openpyxl.comments import Comment
def main(filename, cell):
workbook = load_workbook(filename=filename)
sheet = workbook.active
comment = sheet[cell].comment
print(comment)
if __name__ == "__mai... | 3.1875 | 3 |
qiling/qiling/os/windows/dlls/kernel32/fileapi.py | mrTavas/owasp-fstm-auto | 2 | 36766 | <filename>qiling/qiling/os/windows/dlls/kernel32/fileapi.py
#!/usr/bin/env python3
#
# Cross Platform and Multi Architecture Advanced Binary Emulation Framework
#
import struct, time, os
from shutil import copyfile
from datetime import datetime
from qiling.exception import *
from qiling.os.windows.const import *
f... | 1.84375 | 2 |
algorithm/merge_sort.py | smartdolphin/recommandation-tutorial | 1 | 36767 | import unittest
def merge_sort(arr):
def _merge(left, right):
merged_list = []
i, j = 0, 0
while len(left) > i and len(right) > j:
if left[i] < right[j]:
merged_list.append(left[i])
i += 1
else:
merged_list.append(righ... | 3.8125 | 4 |
run_w2v.py | hugochan/K-Competitive-Autoencoder-for-Text-Analytics | 133 | 36768 | <reponame>hugochan/K-Competitive-Autoencoder-for-Text-Analytics<gh_stars>100-1000
'''
Created on Jan, 2017
@author: hugo
'''
from __future__ import absolute_import
import argparse
from os import path
import timeit
import numpy as np
from autoencoder.baseline.word2vec import Word2Vec, save_w2v, load_w2v
from autoenco... | 2.421875 | 2 |
code/udls/datasets/sol_string.py | acids-ircam/lottery_mir | 10 | 36769 | from .. import DomainAdaptationDataset, SimpleDataset
SolV4folders = [
"/fast-2/datasets/Solv4_strings_wav/audio/Cello",
"/fast-2/datasets/Solv4_strings_wav/audio/Contrabass",
"/fast-2/datasets/Solv4_strings_wav/audio/Violin",
"/fast-2/datasets/Solv4_strings_wav/audio/Viola"
]
def Solv4Strings_Domain... | 2.15625 | 2 |
testsuite/cases/cv2.py | jcupitt/pillow-perf | 0 | 36770 | # coding: utf-8
from __future__ import print_function, unicode_literals, absolute_import
import cv2
from .base import BaseTestCase, root
try:
cv2.setNumThreads(1)
except AttributeError:
print('!!! You are using OpenCV which does not allow you to set '
'the number of threads')
class Cv2TestCase(... | 2.484375 | 2 |
App/main.py | uip-pc3/calculadora-de-comisiones-andrew962 | 0 | 36771 | """Librerias Importadas"""
from flask import Flask
from flask import render_template
from flask import request
App=Flask(__name__)
@App.route('/')
def index():
"""Pagina Principal en donde se introduce el nombre, apellido, comision"""
return render_template('index.html')
@App.route('/porcentaje',methods=... | 3.625 | 4 |
waste_flow/spreading.py | xapple/waste_flow | 1 | 36772 | <reponame>xapple/waste_flow
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Written by <NAME>.
JRC Biomass Project.
Unit D1 Bioeconomy.
Typically you can use this class like this:
>>> from waste_flow.spreading import spread
>>> print(spread.by_nace)
"""
# Built-in modules #
# Internal modules #
from wa... | 2.421875 | 2 |
tests/test_deploy.py | lobziik/ocdeployer | 0 | 36773 | <reponame>lobziik/ocdeployer<gh_stars>0
import pytest
from ocdeployer.secrets import SecretImporter
from ocdeployer.deploy import DeployRunner
from ocdeployer.env import EnvConfigHandler, LegacyEnvConfigHandler
def patched_runner(env_values, mock_load_vars_per_env, legacy=False):
if not env_values:
handl... | 2.21875 | 2 |
app/main/__init__.py | Edwin-Karanu-Muiruri/pitch-perfect | 0 | 36774 | <reponame>Edwin-Karanu-Muiruri/pitch-perfect
from flask import Flask
from flask_bootstrap import Bootstrap
from config import config_options
from flask import Blueprint
main = Blueprint('main',__name__)
from . import views,error
bootstrap = Bootstrap()
| 1.476563 | 1 |
loaner/deployments/lib/password.py | gng-demo/travisfix | 175 | 36775 | # Copyright 2018 Google Inc. All Rights Reserved.
#
# 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 a... | 2.265625 | 2 |
debug/test_call.py | ccj5351/hmr_rgbd | 0 | 36776 | # !/usr/bin/env python3
# -*-coding:utf-8-*-
# @file: test_call.py
# @brief:
# @author: <NAME>, <EMAIL>, <EMAIL>
# @version: 0.0.1
# @creation date: 09-07-2019
# @last modified: Tue 09 Jul 2019 07:09:07 PM EDT
class Stuff(object):
def __init__(self, x, y, rge):
super(Stuff, self).__init__()
self.x... | 2.953125 | 3 |
python/hackerrank/strings-xor.py | leewalter/coding | 0 | 36777 | '''
https://www.hackerrank.com/challenges/strings-xor/submissions/code/102872134
Given two strings consisting of digits 0 and 1 only, find the XOR of the two strings.
'''
def strings_xor(s, t):
res = ""
for i in range(len(s)):
if s[i] != t[i]:
res += '1'
else:
res += '0'... | 3.78125 | 4 |
cleaning_data.py | yoon-gu/dand-p5 | 0 | 36778 | <gh_stars>0
from pandas import DataFrame, read_csv, cut
import numpy as np
df = read_csv('data/baseball_data.csv')
df = df[(df.avg > 0.0) & (df.HR > 0)]
## Split to 5 intervals using pandas.cut function
df['avg_category'] = cut(df.avg,
bins = np.linspace(0.1, 0.35, 6),
right=False)
## Except 'height', ... | 3.046875 | 3 |
model_predict.py | Non1ce/Transformer-Bert | 2 | 36779 | <reponame>Non1ce/Transformer-Bert
# -*- coding: utf-8 -*-
from model_train import pipeline_model
from Data import InputData
"""
Created on 20.07.2021
@author: Nikita
The module is designed to predict the topic of the entered text. To make a prediction, it is enough to run the
module as the main program.... | 3.578125 | 4 |
tests/acceptance/commons/behave_step_helpers.py | telefonicaid/fiware-glancesync | 0 | 36780 | # -*- coding: utf-8 -*-
# Copyright 2015-2016 Telefónica Investigación y Desarrollo, S.A.U
#
# This file is part of FIWARE project.
#
# 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:
#
# htt... | 1.804688 | 2 |
src/video_store/urls.py | staab/video-store | 0 | 36781 | from django.conf.urls import include, url
from django.contrib import admin
from django.views.generic import RedirectView
import store_api.urls
import store_ui.urls
urlpatterns = [
url(r'^admin/', include(admin.site.urls)),
url(r'^api/', include(store_api.urls.urlpatterns)),
url(r'^.*$', include(store_ui.... | 1.609375 | 2 |
pp/samples/13_component_yaml.py | smartalecH/gdsfactory | 16 | 36782 | import pp
def test_mzi():
netlist = """
instances:
CP1:
component: mmi1x2
settings:
width_mmi: 4.5
length_mmi: 10
CP2:
component: mmi1x2
settings:
width_mmi: 4.5
length_mmi: 5
arm_t... | 2.0625 | 2 |
simulated_data.py | aamcbee/AdaOja | 9 | 36783 | import numpy as np
import scipy.linalg as la
from scipy.stats import multinomial
def random_multivar_normal(n, d, k, sigma=.1):
'''
Generate random samples from a random multivariate normal distribution
with covariance A A^T + sigma^2 I.
Input:
n: int, number of samples
d: int, dimensio... | 3.5 | 4 |
livestream/api_test.py | mitodl/open-discussions | 12 | 36784 | """livestream API tests"""
from livestream.api import get_upcoming_events
def test_get_upcoming_events(settings, mocker):
"""test get upcoming events"""
settings.LIVESTREAM_ACCOUNT_ID = 392_239
settings.LIVESTREAM_SECRET_KEY = "secret key"
requests_patch = mocker.patch("requests.get", autospec=True)
... | 2.40625 | 2 |
xcamserver/framebuffer.py | Moskari/xcamserver | 0 | 36785 | '''
Created on 15.2.2017
@author: sapejura
'''
import io
import threading
import struct
class FrameQueue(io.IOBase):
def __init__(self, frame_size):
super().__init__()
self.queue_lock = threading.Lock()
self._queue = bytearray()
self._store_mode = 0
self.frame_size = fram... | 3 | 3 |
tests/test_nmt.py | LSSTDESC/TJPCov | 3 | 36786 | #!/usr/bin/python
import numpy as np
import os
import pymaster as nmt
import pytest
import tjpcov.main as cv
from tjpcov.parser import parse
import yaml
import sacc
root = "./tests/benchmarks/32_DES_tjpcov_bm/"
input_yml = os.path.join(root, "tjpcov_conf_minimal.yaml")
input_yml_no_nmtc = os.path.join(root, "tjpcov_c... | 1.851563 | 2 |
lib/fathead/scikit_learn/fetch.py | aeisenberg/zeroclickinfo-fathead | 0 | 36787 | # -*- coding: utf-8 -*-
from os.path import join
import requests
from bs4 import BeautifulSoup
SCIKIT_LEARN_BASE_URL = 'http://scikit-learn.org/stable/auto_examples/'
SCIKIT_INDEX_URL = 'http://scikit-learn.org/stable/auto_examples/index.html'
def download_file(fetch_me):
"""
Fetches a file in given url int... | 3.171875 | 3 |
frappe-bench/apps/erpnext/erpnext/education/report/student_batch_wise_attendance/student_batch_wise_attendance.py | Semicheche/foa_frappe_docker | 0 | 36788 | # Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
import frappe
from frappe.utils import cstr, cint, getdate
from frappe import msgprint, _
def execute(filters=None):
if not filters: filters = {}
if... | 2.203125 | 2 |
src/role_filter.py | kjkszpj/mifans | 0 | 36789 | <gh_stars>0
import pickle
data = pickle.load(open('../data/record.pk', 'rb'))
namedict = pickle.load(open('../data/namedict.pk', 'rb'))
rndict = {v:k for k, v in namedict.items()}
pickle.dump(rndict, open('../data/rndict.pk', 'wb'))
cnt_name = {v:[0, 0, 0] for v in namedict.values()}
for record in data:
for a in r... | 2.828125 | 3 |
server/internal/rest_server.py | VentionCo/mm-machineapp-template | 0 | 36790 | import logging
from bottle import Bottle, request, response, abort, static_file
import os
import time
import threading
from threading import Thread
from pathlib import Path
import json
import subprocess
import io
import sys
import signal
from internal.notifier import getNotifier, NotificationLevel
from internal.interpr... | 1.945313 | 2 |
minpiler/mind.py | neumond/minpiler | 23 | 36791 | <gh_stars>10-100
import ast
import sys
from contextlib import contextmanager
from dataclasses import dataclass, field
from typing import Any, Callable
from . import mast, utils
_PY = (sys.version_info.major, sys.version_info.minor)
def _get_ast_slice(node):
if _PY >= (3, 9):
return node.slice
else:... | 2.015625 | 2 |
sdk/python/pulumi_aws_native/redshift/_enums.py | AaronFriel/pulumi-aws-native | 29 | 36792 | <gh_stars>10-100
# coding=utf-8
# *** WARNING: this file was generated by the Pulumi SDK Generator. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
from enum import Enum
__all__ = [
'EventSubscriptionEventCategoriesItem',
'EventSubscriptionSeverity',
'EventSubscription... | 2.015625 | 2 |
openmdao/utils/tests/test_cs_safe.py | friedenhe/OpenMDAO | 451 | 36793 | <gh_stars>100-1000
import numpy as np
import unittest
from openmdao.utils import cs_safe
from openmdao.utils.assert_utils import assert_near_equal
class TestCSSafeFuctions(unittest.TestCase):
def test_abs(self):
test_data = np.array([1, -1, -2, 2, 5.675, -5.676], dtype='complex')
assert_near... | 2.25 | 2 |
scripts/main.py | kjenney/community-ops | 14 | 36794 | <reponame>kjenney/community-ops<gh_stars>10-100
#!/usr/bin/env python
from parser.configuration import ConfigurationParser
from deployer.helm import HelmDeployer
from deployer.shell import ShellDeployer
from deployer.kustomize import KustomizeDeployer
from deployer.manifest import ManifestDeployer
from deployer.istio ... | 2.203125 | 2 |
python/ex034.py | deniseicorrea/Aulas-de-Python | 0 | 36795 | salario = float(input('Qual o seu salário? R$ '))
if salario <= 1250:
novo = salario + (salario * 15 / 100)
else:
novo = salario + (salario * 10 / 100)
print(f'Seu novo salário é R${novo :.2f}.') | 3.703125 | 4 |
custom/icds/messaging/custom_recipients.py | kkrampa/commcare-hq | 1 | 36796 | from __future__ import absolute_import
from __future__ import unicode_literals
from corehq.apps.locations.models import SQLLocation
from corehq.form_processor.models import CommCareCaseIndexSQL
from custom.icds.case_relationships import (
mother_person_case_from_ccs_record_case,
mother_person_case_from_child_he... | 1.882813 | 2 |
main.py | tuzhucheng/sent-sim | 109 | 36797 | """
Driver program for training and evaluation.
"""
import argparse
import logging
import numpy as np
import random
import torch
import torch.optim as O
from datasets import get_dataset, get_dataset_configurations
from models import get_model
from runners import Runner
if __name__ == '__main__':
parser = argpar... | 2.296875 | 2 |
dhook.py | Araon/Sadhu-Kamra | 0 | 36798 | <gh_stars>0
import requests
url = "https://discord.com/api/webhooks/<KEY>"
def notify(message):
data = {
"content": "Tweet Posted: "+message,
}
headers = {
"Content-Type": "application/json"
}
result = requests.post(url, json=data, headers=headers)
if 200 <= result.status_c... | 3.09375 | 3 |
proganomaly_modules/training_module/trainer/training_inputs.py | ryangillard/P-CEAD | 6 | 36799 | <reponame>ryangillard/P-CEAD<gh_stars>1-10
# Copyright 2020 Google Inc. All Rights Reserved.
#
# 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... | 2.171875 | 2 |