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 |
|---|---|---|---|---|---|---|
code/bot/bot3.py | josemac95/umucv | 0 | 20200 | #! /usr/bin/env python
# comando con argumentos
# y procesamiento de una imagen
# enviada por el usuario
from telegram.ext import Updater, CommandHandler, MessageHandler, Filters
from io import BytesIO
from PIL import Image
import cv2 as cv
import skimage.io as io
updater = Updater('api token del bot')
def sendImag... | 2.6875 | 3 |
AUTOENCODERS/DataPreparing/CICIDSPreprocessor.py | pawelptak/AI-Anomaly-Detection | 1 | 20201 | from sklearn.preprocessing import StandardScaler, LabelEncoder, MinMaxScaler, OneHotEncoder
import numpy as np
import pandas as pd
import tqdm
"""
Class for Preprocessing CICIDS2017 Data represented as rows
"""
class CICIDSPreprocessor:
def __init__(self):
self.to_delete_columns = ['Flow ID', ' Timestamp... | 2.953125 | 3 |
class3/collateral/show_genie.py | twin-bridges/netmiko_course | 11 | 20202 | import os
from netmiko import ConnectHandler
from getpass import getpass
from pprint import pprint
# Code so automated tests will run properly
# Check for environment variable, if that fails, use getpass().
password = os.getenv("NETMIKO_PASSWORD") if os.getenv("NETMIKO_PASSWORD") else getpass()
my_device = {
"dev... | 2.328125 | 2 |
pints/tests/test_toy_hes1_michaelis_menten_model.py | lisaplag/pints | 0 | 20203 | <gh_stars>0
#!/usr/bin/env python3
#
# Tests if the HES1 Michaelis-Menten toy model runs.
#
# This file is part of PINTS (https://github.com/pints-team/pints/) which is
# released under the BSD 3-clause license. See accompanying LICENSE.md for
# copyright notice and full license details.
#
import unittest
import numpy ... | 2.734375 | 3 |
pyctogram/instagram_client/relations/__init__.py | RuzzyRullezz/pyctogram | 1 | 20204 | <gh_stars>1-10
from . base import Actions, get_users
def get_followers(username, password, victim_username, proxies=None):
return get_users(username, password, victim_username, proxies=proxies, relation=Actions.followers)
def get_followings(username, password, victim_username, proxies=None):
return get_user... | 2.234375 | 2 |
day-40-API-Cheapest-Flight-Multiple-Users/data_manager.py | anelshaer/Python100DaysOfCode | 0 | 20205 | import requests
import os
from user_data import UserData
import json
class DataManager:
"""This class is responsible for talking to the Google Sheet."""
def __init__(self) -> None:
self.SHEETY_URL = f"https://api.sheety.co/{os.environ['SHEETY_SHEET_ID']}/pythonFlightDeals"
self.sheet_data = {... | 3.1875 | 3 |
crime_data/resources/incidents.py | 18F/crime-data-api | 51 | 20206 | <reponame>18F/crime-data-api
from webargs.flaskparser import use_args
from itertools import filterfalse
from crime_data.common import cdemodels, marshmallow_schemas, models, newmodels
from crime_data.common.base import CdeResource, tuning_page, ExplorerOffenseMapping
from crime_data.extensions import DEFAULT_MAX_AGE
fr... | 2.328125 | 2 |
deploy_config_generator/output/kube_kong_consumer.py | ApplauseAQI/applause-deploy-config-generator | 3 | 20207 | import copy
from deploy_config_generator.utils import yaml_dump
from deploy_config_generator.output import kube_common
class OutputPlugin(kube_common.OutputPlugin):
NAME = 'kube_kong_consumer'
DESCR = 'Kubernetes KongConsumer output plugin'
FILE_EXT = '.yaml'
DEFAULT_CONFIG = {
'fields': {
... | 1.953125 | 2 |
EyePatterns/clustering_algorithms/custom_mean_shift.py | Sale1996/Pattern-detection-of-eye-tracking-scanpaths | 1 | 20208 | <reponame>Sale1996/Pattern-detection-of-eye-tracking-scanpaths<filename>EyePatterns/clustering_algorithms/custom_mean_shift.py
import numpy as np
class MeanShift:
def __init__(self, radius=2):
self.radius = radius
def fit(self, data):
centroids = self.initialize_starting_centroids(data)
... | 2.796875 | 3 |
src/tentaclio/clients/athena_client.py | datavaluepeople/tentaclio | 12 | 20209 | """AWS Athena query client.
Overrides the `get_df` convenience methods for loading a DataFrame using PandasCursor,
which is more performant than using sql alchemy functions.
"""
import pandas as pd
from pyathena.pandas_cursor import PandasCursor
from . import decorators, sqla_client
__all__ = ["AthenaClient"]
cl... | 2.90625 | 3 |
tests/unit/merge/merge_test.py | singulared/conflow | 11 | 20210 | import pytest
from conflow.merge import merge_factory
from conflow.node import Node, NodeList, NodeMap
def test_merge_node_node(default_config):
base = Node('base', 'node_A')
other = Node('other', 'node_B')
assert merge_factory(base, other, default_config) == other
def test_merge_node_nodelist(default_... | 2.5 | 2 |
cartopolar/antarctica_maps.py | dlilien/cartopolar | 0 | 20211 | #! /usr/bin/env python
# -*- coding: utf-8 -*-
# vim:fenc=utf-8
#
# Copyright © 2020 dlilien <<EMAIL>>
#
# Distributed under terms of the MIT license.
"""
"""
import numpy as np
import cartopy.crs as ccrs
import matplotlib.pyplot as plt
from .cartopy_overrides import SPS
# import shapely.geometry as sgeom
USP_EXTEN... | 1.953125 | 2 |
cpdb/toast/tests/test_serializers.py | invinst/CPDBv2_backend | 25 | 20212 | <reponame>invinst/CPDBv2_backend
from django.test import TestCase
from robber import expect
from toast.serializers import ToastDesktopSerializer, ToastMobileSerializer
from toast.factories import ToastFactory
class ToastDesktopSerializerTestCase(TestCase):
def test_serialization(self):
toast = ToastFacto... | 2.296875 | 2 |
wirepas_backend_client/test/kpi_adv.py | PFigs/backend-client | 0 | 20213 | <gh_stars>0
"""
KPI ADV
=======
Script to execute an inventory and otap benchmark for the
advertiser feature.
.. Copyright:
Copyright 2019 Wirepas Ltd under Apache License, Version 2.0.
See file LICENSE for full license details.
"""
import queue
import random
import datetime
impor... | 2.359375 | 2 |
levenshtein_func.py | Lance-Easley/Document-Similarity | 0 | 20214 | <filename>levenshtein_func.py
import doctest
def leven_distance(iterable1: str or list, iterable2: str or list) -> int:
"""Takes two strings or lists and will find the Levenshtein distance
between the two.
Both iterables must be same type (str or list) for proper functionality.
If given strings, fun... | 3.875 | 4 |
filters/Filter.py | Paul1298/ITMO_FS | 0 | 20215 | <gh_stars>0
from .utils import *
class Filter(object):####TODO add logging
def __init__(self, measure, cutting_rule):
"""
Basic univariate filter class with chosen(even custom) measure and cutting rule
:param measure:
Examples
--------
>>> f=Filter("PearsonCor... | 2.6875 | 3 |
h3.py | alexfmsu/pyquantum | 0 | 20216 | from PyQuantum.TC3.Cavity import Cavity
from PyQuantum.TC3.Hamiltonian3 import Hamiltonian3
capacity = {
'0_1': 2,
'1_2': 2,
}
wc = {
'0_1': 0.2,
'1_2': 0.3,
}
wa = [0.2] * 3
g = {
'0_1': 1,
'1_2': 200,
}
cv = Cavity(wc=wc, wa=wa, g=g, n_atoms=3, n_levels=3)
# cv.wc_info()
# cv.wa_info()
#... | 2.359375 | 2 |
gamestate-changes/change_statistics/other/rectangleAnimation.py | phylib/MinecraftNDN-RAFNET19 | 1 | 20217 | <filename>gamestate-changes/change_statistics/other/rectangleAnimation.py<gh_stars>1-10
# https://stackoverflow.com/questions/31921313/matplotlib-animation-moving-square
import matplotlib.pyplot as plt
import matplotlib.patches as patches
from matplotlib import animation
x = [0, 1, 2]
y = [0, 10, 20]
y2 = [40, 30, 20]... | 3.296875 | 3 |
MakeMytripChallenge/script/IFtrial.py | divayjindal95/DataScience | 0 | 20218 | import sys
import warnings
if not sys.warnoptions:
warnings.simplefilter("ignore")
import numpy as np
import pandas as pd
import matplotlib.pylab as plt
from sklearn.naive_bayes import MultinomialNB
from sklearn.ensemble import RandomForestClassifier
from sklearn.ensemble import GradientBoostingClassifier
from ... | 2.625 | 3 |
qf_lib/backtesting/order/order_factory.py | webclinic017/qf-lib | 198 | 20219 | # Copyright 2016-present CERN – European Organization for Nuclear Research
#
# 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... | 1.804688 | 2 |
src/test_network3.py | chansonzhang/FirstDL | 0 | 20220 | <gh_stars>0
# -*- coding: utf-8 -*-
# Copyright 2018 <NAME>. 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
#
# Un... | 1.992188 | 2 |
mood_sense/serializers.py | D-Denysenko/health-app | 0 | 20221 | from rest_framework import serializers
from .models import Mood
class MoodSerializer(serializers.ModelSerializer):
class Meta:
model = Mood
fields = ['profile', 'characteristic', 'latitude', 'longitude', 'image', 'location']
read_only_fields = ['latitude', 'longitude']
| 2.1875 | 2 |
Appserver/Test/ApiUnitTesting/testBusquedaCandidatos.py | seguijoaquin/taller2 | 2 | 20222 | <gh_stars>1-10
import json
import requests
import unittest
import Utilities
# Precondiciones:
# Intereses:
# No debe haber ningun usuario en el Shared que tenga "interesUnico"
#
Address = "http://localhost:8000"
#Tal vez mandar las URIs a sus respectivas clases
URIResgistro = "/registro"
URILogin = "/login"
URIPe... | 2.796875 | 3 |
scripts/plots/yearly_summary.py | jarad/dep | 1 | 20223 | <gh_stars>1-10
import datetime
import cStringIO
import psycopg2
from shapely.wkb import loads
import numpy as np
import sys
from geopandas import read_postgis
import matplotlib
matplotlib.use("agg")
from pyiem.plot import MapPlot
import matplotlib.pyplot as plt
from matplotlib.patches import Polygon
from matplotlib.co... | 2.1875 | 2 |
package/diana/utils/iter_dates.py | thomasyi17/diana2 | 15 | 20224 | <filename>package/diana/utils/iter_dates.py
from datetime import datetime, timedelta
class IterDates(object):
def __init__(self, start: datetime, stop: datetime, step: timedelta):
self.start = start
self.stop = stop
self.step = step
self.value = (self.start, self.start + self.step... | 3.40625 | 3 |
Exercicios Curso Em Video Mundo 2/ex067.py | JorgeTranin/Python_Curso_Em_Video | 0 | 20225 | <gh_stars>0
cont = 1
while True:
t = int(input('Quer saber a tabuada de que numero ? '))
if t < 0:
break
for c in range (1, 11):
print(f'{t} X {c} = {t * c}')
print('Obrigado!') | 3.46875 | 3 |
src/PassGen/PassGen.py | Natthapolmnc/PasswordGenerator | 0 | 20226 | import random as rd
def genPass(num , length):
print ("Password Generator")
print ("===================\n")
numpass=num
lenpass=length
AlphaLcase=[ chr(m) for m in range(65, 91)]
AlphaCcase=[ chr(n) for n in range(97, 123)]
Intset=[ chr(p) for p in range(48,58)]
listsetpass=[]
for j... | 3.25 | 3 |
services/offers_service.py | martinmladenov/RankingBot | 2 | 20227 | from datetime import date, datetime, timedelta
from matplotlib import pyplot as plt, dates as mdates
from matplotlib.ticker import MaxNLocator
from helpers import programmes_helper
filename = 'offers.png'
class OffersService:
def __init__(self, db_conn):
self.db_conn = db_conn
async def generate_gra... | 2.75 | 3 |
lib/python3.8/site-packages/ansible_collections/community/postgresql/plugins/modules/postgresql_user_obj_stat_info.py | cjsteel/python3-venv-ansible-2.10.5 | 0 | 20228 | <filename>lib/python3.8/site-packages/ansible_collections/community/postgresql/plugins/modules/postgresql_user_obj_stat_info.py
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright: (c) 2020, <NAME> (@Andersson007) <<EMAIL>>
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
... | 1.625 | 2 |
lib/run_config.py | king/s3vdc | 10 | 20229 | <reponame>king/s3vdc
"""
Copyright (C) king.com Ltd 2019
https://github.com/king/s3vdc
License: MIT, https://raw.github.com/king/s3vdc/LICENSE.md
"""
import tensorflow as tf
def _session_config() -> tf.ConfigProto:
"""Constructs a session config specifying gpu memory usage.
Returns:
tf.ConfigProto ... | 2.34375 | 2 |
tests/test_address_book.py | kibernick/pycontacts | 0 | 20230 | <filename>tests/test_address_book.py<gh_stars>0
from pycontacts import AddressBook
from pycontacts.models import Person
from pycontacts.managers import (
EmailAddressManager,
GroupManager,
PhoneNumberManager,
PersonManager,
StreetAddressManager,
)
def test_create_book():
book = AddressBook()
... | 2.765625 | 3 |
lifeloopweb/db/models.py | jaimecruz21/lifeloopweb | 0 | 20231 | #!/usr/bin/env python
# pylint: disable=no-value-for-parameter,too-many-nested-blocks
import contextlib
import datetime
import functools
import re
from abc import abstractmethod
import sqlalchemy as sa
from sqlalchemy import event, exc, func, select
from sqlalchemy.ext import declarative
from sqlalchemy.ext import hy... | 1.960938 | 2 |
gc_win1.py | danz2004/learning_python | 0 | 20232 | <reponame>danz2004/learning_python<filename>gc_win1.py
#!/usr/bin/env python3
seq = 'ACGACGCAGGAGGAGAGTTTCAGAGATCACGAATACATCCATATTACCCAGAGAGAG'
w = 11
for i in range(len(seq) - w + 1):
count = 0
for j in range(i, i + w):
if seq[j] == 'G' or seq[j] == 'C':
count += 1
print(f'{i} {seq[i:i+w]} {(count / w) : .4f}'... | 2.859375 | 3 |
test/test_auth.py | tjones-commits/server-client-python | 470 | 20233 | import unittest
import os.path
import requests_mock
import tableauserverclient as TSC
TEST_ASSET_DIR = os.path.join(os.path.dirname(__file__), 'assets')
SIGN_IN_XML = os.path.join(TEST_ASSET_DIR, 'auth_sign_in.xml')
SIGN_IN_IMPERSONATE_XML = os.path.join(TEST_ASSET_DIR, 'auth_sign_in_impersonate.xml')
SIGN_IN_ERROR_X... | 2.4375 | 2 |
gym_flock/envs/old/flocking.py | katetolstaya/gym-flock | 19 | 20234 | import gym
from gym import spaces, error, utils
from gym.utils import seeding
import numpy as np
import configparser
from os import path
import matplotlib.pyplot as plt
from matplotlib.pyplot import gca
font = {'family': 'sans-serif',
'weight': 'bold',
'size': 14}
class FlockingEnv(gym.Env):
def... | 2.5 | 2 |
dataPipelines/gc_scrapy/gc_scrapy/spiders/army_reserve_spider.py | ekmixon/gamechanger-crawlers | 8 | 20235 | <filename>dataPipelines/gc_scrapy/gc_scrapy/spiders/army_reserve_spider.py
import scrapy
import re
from urllib.parse import urljoin, urlencode, parse_qs
from dataPipelines.gc_scrapy.gc_scrapy.items import DocItem
from dataPipelines.gc_scrapy.gc_scrapy.GCSpider import GCSpider
type_and_num_regex = re.compile(r"([a-zA-Z... | 2.609375 | 3 |
lbrynet/daemon/Publisher.py | Invariant-Change/lbry | 0 | 20236 | <reponame>Invariant-Change/lbry<gh_stars>0
import logging
import mimetypes
import os
from twisted.internet import defer
from lbrynet.core import file_utils
from lbrynet.file_manager.EncryptedFileCreator import create_lbry_file
log = logging.getLogger(__name__)
class Publisher(object):
def __init__(self, sessio... | 2 | 2 |
SAMPNet/train.py | bcmi/Image-Composition-Assessment-with-SAMP | 27 | 20237 | import sys,os
from torch.autograd import Variable
import torch.optim as optim
from tensorboardX import SummaryWriter
import torch
import time
import shutil
from torch.utils.data import DataLoader
import csv
from samp_net import EMDLoss, AttributeLoss, SAMPNet
from config import Config
from cadb_dataset import CADBData... | 2.0625 | 2 |
combine_layer.py | Lynton-Morgan/combine_layer | 0 | 20238 | <filename>combine_layer.py
import keras
import keras.backend as K
class Combine(keras.layers.Layer):
"""Combine layer
This layer recombines the output of its internal layers
#Arguments
layers: A list of Keras layers
output_spec: A list of integer lists, indices from each layer in 'layers'
... | 3.265625 | 3 |
src/pystage/core/_sound.py | pystage/pystage | 12 | 20239 | import pygame
from pygame.mixer import music
from pystage.core.assets import SoundManager
from pystage.core._base_sprite import BaseSprite
import time
class _Sound(BaseSprite):
# Like for costumes and backdrops, we need a class structure here.
# Plus a global sound manager.
def __init__(self):
su... | 3.0625 | 3 |
tests/test_runner/test_discover_runner.py | tomleo/django | 1 | 20240 | <reponame>tomleo/django<filename>tests/test_runner/test_discover_runner.py
from django.test import TestCase
from django.test.runner import DiscoverRunner
class DiscoverRunnerTest(TestCase):
def test_dotted_test_module(self):
count = DiscoverRunner().build_suite(
["test_discovery_sample.tests_... | 2.25 | 2 |
src/ggrc/rbac/__init__.py | Killswitchz/ggrc-core | 0 | 20241 | # Copyright (C) 2017 Google Inc.
# Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file>
"""Basic permissions module."""
from sqlalchemy import or_
class SystemWideRoles(object):
"""List of system wide roles."""
# pylint: disable=too-few-public-methods
SUPERUSER = u"Superuser"
ADMINI... | 2.390625 | 2 |
buildingspy/examples/dymola/plotResult.py | Mathadon/BuildingsPy | 0 | 20242 | <reponame>Mathadon/BuildingsPy<gh_stars>0
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# import from future to make Python2 behave like Python3
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
from future import stand... | 2.546875 | 3 |
tango_with_django_project/rango/admin.py | DADDYKIKI/tango_with_django_project | 0 | 20243 | from django.contrib import admin
from rango.models import Category, Page
admin.site.register(Page)
admin.site.register(Category)
class CategoryAdmin(admin.ModelAdmin):
prepopulated_fields = {'slug':('name',)}
class PageAdmin(admin.ModelAdmin):
list_display = ('title',
'cate... | 1.914063 | 2 |
components/python/scripts/bootstrap_validate.py | cloudify-cosmo/cloudify-manager-blueprints | 35 | 20244 | <reponame>cloudify-cosmo/cloudify-manager-blueprints
#!/usr/bin/env python
from os.path import join, dirname
from cloudify import ctx
ctx.download_resource(
join('components', 'utils.py'),
join(dirname(__file__), 'utils.py'))
import utils # NOQA
# Most images already ship with the following packages:
#
# ... | 1.921875 | 2 |
subdomains/gen_master_data.py | sjy5386/subshorts | 3 | 20245 | from .models import ReservedName
def gen_master(apps, scheme_editor):
reserved_names = ['co', 'com', 'example', 'go', 'gov', 'icann', 'ne', 'net', 'nic', 'or', 'org', 'whois', 'www']
for reserved_name in reserved_names:
ReservedName(name=reserved_name).save()
| 2.328125 | 2 |
promort_tools/converters/zarr_to_tiledb.py | mdrio/promort_tools | 0 | 20246 | # Copyright (c) 2021, CRS4
#
# Permission is hereby granted, free of charge, to any person obtaining a copy of
# this software and associated documentation files (the "Software"), to deal in
# the Software without restriction, including without limitation the rights to
# use, copy, modify, merge, publish, distribu... | 1.96875 | 2 |
awx/main/migrations/0082_v360_webhook_http_method.py | Avinesh/awx | 11,396 | 20247 | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations
def add_webhook_notification_template_fields(apps, schema_editor):
# loop over all existing webhook notification templates and make
# sure they have the new "http_method" field filled in with "POST"
Notificat... | 1.867188 | 2 |
tunga/preprocessing/__init__.py | tahtaciburak/tunga | 5 | 20248 | <gh_stars>1-10
from .normalization import * | 1.171875 | 1 |
runtests.py | resurrexi/django-restql | 545 | 20249 | #!/usr/bin/env python
import os
import sys
import subprocess
from django.core.management import execute_from_command_line
FLAKE8_ARGS = ['django_restql', 'tests', 'setup.py', 'runtests.py']
WARNING_COLOR = '\033[93m'
END_COLOR = '\033[0m'
def flake8_main(args):
print('Running flake8 code linting')
ret = su... | 2.109375 | 2 |
structured_tables/parser.py | CivicKnowledge/structured_tables | 0 | 20250 | # Copyright (c) 2016 Civic Knowledge. This file is licensed under the terms of the
# Revised BSD License, included in this distribution as LICENSE
"""
Parser for the Simple Data Package format. The parser consists of several iterable generator
objects.
"""
NO_TERM = '<no_term>' # No parent term -- no '.' -- in ter... | 3.109375 | 3 |
plugins/playbook/deploy_cluster/decapod_plugin_playbook_deploy_cluster/monitor_secret.py | angry-tony/ceph-lcm-decapod | 41 | 20251 | # -*- coding: utf-8 -*-
# Copyright (c) 2016 Mirantis Inc.
#
# 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 ... | 2.03125 | 2 |
scripts/v1/03-collectAllModels.py | groppcw/CLDA | 6 | 20252 | <filename>scripts/v1/03-collectAllModels.py
# take a bunch of model_0 model_1 etc files and merge them alphabetically
from settings import *
# for each file, load the file into one giant list
# call sort on the list
# write this output somewhere else
for timestep in range(START_IDX,NUM_TIMES):
model = dict()
... | 2.609375 | 3 |
controller/hopfields_registration_server.py | SIDN/p4-scion | 2 | 20253 | <filename>controller/hopfields_registration_server.py
# Copyright (c) 2021, SIDN Labs
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above cop... | 1.414063 | 1 |
Server/Python/src/dbs/dao/Oracle/MigrationBlock/Update.py | vkuznet/DBS | 8 | 20254 | <filename>Server/Python/src/dbs/dao/Oracle/MigrationBlock/Update.py
#!/usr/bin/env python
"""
This module provides Migration.Update data access object.
"""
from WMCore.Database.DBFormatter import DBFormatter
from dbs.utils.dbsExceptionHandler import dbsExceptionHandler
from dbs.utils.DBSDaoTools import create_token_gen... | 2.453125 | 2 |
cldfbench_lapollaqiang.py | cldf-datasets/lapollaqiang | 0 | 20255 | import re
import pathlib
from clldutils.text import strip_chars
from cldfbench import Dataset as BaseDataset
from cldfbench import CLDFSpec
QUOTES = '“”'
class Dataset(BaseDataset):
dir = pathlib.Path(__file__).parent
id = "lapollaqiang"
def cldf_specs(self): # A dataset must declare all CLDF sets it ... | 2.515625 | 3 |
simple-zero-width-chars-encoder-and-decoder/encoder.py | MihaiAC/Other-Projects | 0 | 20256 | <filename>simple-zero-width-chars-encoder-and-decoder/encoder.py
import sys
import os
def convert_word_to_zero_length_list(word):
ls = []
# Convert each character into a zero-width sequence and save them into ls.
for char in word:
# Convert char to binary.
binary_char = bin(ord(char))
... | 3.890625 | 4 |
setup.py | lambdaofgod/HOTT | 0 | 20257 | <filename>setup.py
from setuptools import setup, find_packages
with open('requirements.txt') as f:
requirements = f.read().splitlines()
setup(
name='HOTT',
version='0.1',
url='https://github.com/lambdaofgod/HOTT',
packages=find_packages(),
install_requires=requirements
)
| 1.53125 | 2 |
setup.py | mdmix4/pymdmix-run | 0 | 20258 | #!/usr/bin/env python3
from setuptools import setup
def getRequirements():
requirements = []
with open("requirements.txt", "r") as reqfile:
for line in reqfile.readlines():
requirements.append(line.strip())
return requirements
def getVersion():
return "0.0.2"
setup(
python... | 1.914063 | 2 |
aether/forum/forms.py | katajakasa/aetherguild4 | 0 | 20259 | <gh_stars>0
from django.forms import Form, ModelForm, CharField, Textarea
from django.db import transaction
from django.utils.translation import gettext_lazy as _
from crispy_forms.helper import FormHelper
from crispy_forms.layout import Submit
from .models import ForumPost, ForumThread, ForumBoard, ForumPostEdit
cl... | 2.109375 | 2 |
for_straight_forward_relion/read_star_del_metadata_param.py | homurachan/Block-based-recontruction | 11 | 20260 | #!/usr/bin/env python
import math,os,sys
try:
from optparse import OptionParser
except:
from optik import OptionParser
def main():
(star,mline,line_name,output) = parse_command_line()
aa=open(star,"r")
instar_line=aa.readlines()
out=open(output,"w")
for i in range(0,mline):
if (instar_line[i].split()):
... | 2.515625 | 3 |
python/GafferUI/ProgressBar.py | cwmartin/gaffer | 0 | 20261 | <gh_stars>0
##########################################################################
#
# Copyright (c) 2011-2012, Image Engine Design Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
#... | 0.828125 | 1 |
minihack/agent/rllib/models.py | samvelyan/minihack-1 | 1 | 20262 | # Copyright (c) Facebook, Inc. and its affiliates.
#
# 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 ... | 1.929688 | 2 |
old/projects/6.884/hybrid_twolinkmanipulator_with_GreedyFeatures.py | ali493/pyro | 0 | 20263 | <reponame>ali493/pyro<gh_stars>0
# -*- coding: utf-8 -*-
"""
Created on Wed Mar 23 12:50:34 2016
@author: alex
"""
from AlexRobotics.dynamic import Manipulator as M
from AlexRobotics.dynamic import Hybrid_Manipulator as HM
from AlexRobotics.control import DPO_features as DPO
import numpy as np
# ... | 1.890625 | 2 |
depthaware/data/sunrgbd_dataset.py | crmauceri/DepthAwareCNN-pytorch1.5 | 3 | 20264 | import os.path
from depthaware.data.base_dataset import *
from PIL import Image
import time
def make_dataset_fromlst(dataroot, listfilename):
"""
NYUlist format:
imagepath seglabelpath depthpath HHApath
"""
images = []
segs = []
depths = []
HHAs = []
with open(listfilename) as f:
... | 2.1875 | 2 |
setup.py | elafefy11/flask_gtts | 0 | 20265 | <filename>setup.py<gh_stars>0
"""
Flask-gTTS
-------------
A Flask extension to add gTTS Google text to speech, into the template,
it makes adding and configuring multiple text to speech audio files at
a time much easier and less time consuming
"""
from setuptools import setup
setup(
name='Flask-gTTS',
vers... | 1.445313 | 1 |
READ.py | BeatrizFS/MongoDB-Python | 0 | 20266 | from Arquivo1 import Produto
#READ
#Consultar o Banco de dados
#1.Retorna todas as informações do Banco de dados
produtos = Produto.objects()
print(produtos)
for produto in produtos:
print(produto.Nome, produto.Valor) | 3.046875 | 3 |
src/aux_funcs.py | ArunBaskaran/Image-Driven-Machine-Learning-Approach-for-Microstructure-Classification-and-Segmentation-Ti-6Al-4V | 7 | 20267 | """
----------------------------------ABOUT-----------------------------------
Author: <NAME>
--------------------------------------------------------------------------
"""
import model_params
def smooth(img):
return 0.5*img + 0.5*(
np.roll(img, +1, axis=0) + np.roll(img, -1, axis=0) +
np.roll(img... | 2.515625 | 3 |
manage.py | Stupnitskiy/BinaryAPI | 0 | 20268 | from flask_script import Manager
from src import app
manager = Manager(app)
if __name__ == "__main__":
manager.run()
| 1.390625 | 1 |
CIFAR10.py | jimmyLeeMc/NeuralNetworkTesting | 0 | 20269 |
#CIFAR
from tensorflow import keras
import numpy as np
import matplotlib.pyplot as plt
data = keras.datasets.cifar10
activations=[keras.activations.sigmoid, keras.activations.relu,
keras.layers.LeakyReLU(), keras.activations.tanh]
results=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]
class_names=[0,1,2,3,4,5,6,7,8,9]
... | 2.84375 | 3 |
All_RasPy_Files/edgedetection.py | govindak-umd/Autonomous_Robotics | 2 | 20270 | # ENME 489Y: Remote Sensing
# Edge detection
import numpy as np
import matplotlib
import matplotlib.pyplot as plt
# Define slice of an arbitrary original image
f = np.empty((0))
index = np.empty((0))
# Create intensity data, including noise
for i in range(2000):
index = np.append(index, i)
if i <= 950:
... | 3.1875 | 3 |
alipay/aop/api/domain/AlipayCommerceReceiptBatchqueryModel.py | antopen/alipay-sdk-python-all | 0 | 20271 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
from alipay.aop.api.constant.ParamConstants import *
class AlipayCommerceReceiptBatchqueryModel(object):
def __init__(self):
self._level = None
self._out_biz_no_list = None
@property
def level(self):
return self._level
... | 2.171875 | 2 |
tests/test_timeconversion.py | FObersteiner/pyFuppes | 1 | 20272 | <filename>tests/test_timeconversion.py
import unittest
from datetime import datetime, timezone
from pyfuppes import timeconversion
class TestTimeconv(unittest.TestCase):
@classmethod
def setUpClass(cls):
# to run before all tests
print("testing pyfuppes.timeconversion...")
... | 3.03125 | 3 |
ucscentralsdk/methodmeta/LstorageCloneMeta.py | ragupta-git/ucscentralsdk | 0 | 20273 | """This module contains the meta information of LstorageClone ExternalMethod."""
from ..ucscentralcoremeta import MethodMeta, MethodPropertyMeta
method_meta = MethodMeta("LstorageClone", "lstorageClone", "Version142b")
prop_meta = {
"cookie": MethodPropertyMeta("Cookie", "cookie", "Xs:string", "Version142b", "In... | 1.914063 | 2 |
tool/powermon.py | virajpadte/Power_monitoring_JetsonTX1 | 0 | 20274 | <gh_stars>0
import sys
import glob
import serial
import ttk
import tkFileDialog
from Tkinter import *
#for plotting we need these:
import matplotlib
matplotlib.use("TkAgg")
import matplotlib.pyplot as plt
from drawnow import *
class MainView:
#CLASS VARIABLES:
closing_status = False
powerW = []
def... | 2.609375 | 3 |
shop/tests/products/views/test_product_details_view.py | nikolaynikolov971/NftShop | 0 | 20275 | from django.test import TestCase, Client
from django.urls import reverse
from shop.products.models import Product
from tests.base.mixins import ProductTestUtils
class ProductDetailsTest(ProductTestUtils, TestCase):
def setUp(self):
self.client = Client()
self.product = self.create_product(
... | 2.375 | 2 |
projetoFTP/servidor/sftps.py | MarciovsRocha/conectividade-sistemas-cyberfisicos | 0 | 20276 | import socket
import threading
import os
import sys
from pathlib import Path
#---------------------------------------------------
def ReadLine(conn):
line = ''
while True:
try:
byte = conn.recv(1)
except:
print('O cliente encerrou')
return 0
... | 3.046875 | 3 |
messages.py | runjak/hoodedFigure | 0 | 20277 | <reponame>runjak/hoodedFigure
# -*- coding: utf-8 -*-
import random
sentences = [
"Going into the #dogpark is not allowed, @%s.",
"That's my favourite #dogpark @%s - no one is allowed to go into it!",
"That #dogpark you mention is forbidden! Please don't, @%s",
"The #dogpark should be secured with el... | 2.625 | 3 |
detectron/tests/test_track_losses.py | orestis-z/track-rcnn | 9 | 20278 | <filename>detectron/tests/test_track_losses.py
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import numpy as np
from scipy import spatial
import unittest
from caffe2.proto import caffe2_pb2
from caffe2.python import... | 2.265625 | 2 |
torch/nn/_functions/thnn/upsampling.py | UmaTaru/run | 0 | 20279 | from numbers import Integral
import torch
from torch.autograd import Function
from torch._thnn import type2backend
from . import _all_functions
from ...modules.utils import _pair
from ...functional import _check_bilinear_2d_scale_factor
class _UpsamplingBase(Function):
def __init__(self, size=None, scale_factor... | 2.328125 | 2 |
Day17/17_trick_shot.py | schca675/my-code-for-advent-of-code-2021 | 0 | 20280 | # --- Day 17: Trick Shot ---
import math
import time
def get_puzzle_input(filepath):
with open(filepath) as f:
for line in f:
# target area: x=269..292, y =-68..-44
parts = line.rstrip().replace(',', '').split()
[x1, x2] = parts[2][2:].split("..")
[y1, y2] =... | 3.3125 | 3 |
zip_files.py | VladimirsHisamutdinovs/Advanced_Python_Operations | 0 | 20281 | import zipfile
zip_file = zipfile.ZipFile("zip_archive.zip", "w")
zip_file.write("textfile_for_zip_01")
zip_file.write("textfile_for_zip_02")
zip_file.write("textfile_for_zip_03")
# print(zipfile.is_zipfile("zip_archive.zip"))
# zip_file = zipfile.ZipFile("zip_archive.zip")
# print(zip_file.namelist())
... | 3.625 | 4 |
omdrivers/lifecycle/iDRAC/iDRACUpdate.py | rajroyce1212/Ansible-iDRAC | 61 | 20282 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
#
# Copyright © 2018 Dell Inc. or its subsidiaries. All rights reserved.
# Dell, EMC, and other trademarks are trademarks of Dell Inc. or its subsidiaries.
# Other trademarks may be trademarks of their respective owners.
#
# Licensed under the Apache License, Ver... | 1.367188 | 1 |
playthrough/management/commands/migrate_shogun.py | SciADV-Community/genki | 0 | 20283 | <filename>playthrough/management/commands/migrate_shogun.py
import argparse
import os
import sqlite3
from django.core.management.base import BaseCommand
from playthrough.models import Alias, Channel, Game, GameConfig, Guild, RoleTemplate, User
class Command(BaseCommand):
help = 'Migrates a DB from \'Shogun\' bo... | 2.578125 | 3 |
backend/model/benchmark-metrics/service/ocr.py | agupta54/ulca | 3 | 20284 | import logging
from datetime import datetime
import numpy as np
from logging.config import dictConfig
from kafkawrapper.producer import Producer
from utils.mongo_utils import BenchMarkingProcessRepo
from configs.configs import ulca_notifier_input_topic, ulca_notifier_benchmark_completed_event, ulca_notifier_benchmark_f... | 2.109375 | 2 |
keystroke/migrations/0001_initial.py | jstavanja/quiz-biometrics-api | 0 | 20285 | <reponame>jstavanja/quiz-biometrics-api<gh_stars>0
# -*- coding: utf-8 -*-
# Generated by Django 1.11.15 on 2018-08-20 16:31
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies =... | 1.65625 | 2 |
komposisjon/komposisjon/rektangler_kvadrater.py | knutsenfiksdal/Oving_8 | 0 | 20286 | class Rektangel:
def __init__(self, start_x, start_y, bredde, hoyde):
self.start_x = start_x
self.start_y = start_y
self.hoyde = hoyde
self.bredde = bredde
def areal(self):
return self.bredde*self.hoyde
# Endrer høyde og bredde på en slik måte at areal forblir det s... | 3.609375 | 4 |
DiscordBot/Commands/DiscordPoints.py | aronjanosch/kirbec-bot | 0 | 20287 | from datetime import datetime
import discord
import itertools
from .utils import formatString, getUsageEmbed, getOopsEmbed
# IDEAS
# 1. Paying out points (without bets)
class DiscordPoints:
"""
Class that parses Discord Points info and interactions
Attributes
__________
fire (Fire obj): The fire... | 3.25 | 3 |
lunch/admin.py | KrzysztofSakowski/lunch-crawler | 1 | 20288 | from django.contrib import admin
from .models import MenuFacebook, MenuEmail, UserProfile, Occupation, FacebookRestaurant, EmailRestaurant
class MenuBaseAdmin(admin.ModelAdmin):
list_display = ('id', 'format_date', 'is_lunch', 'message')
list_filter = ('created_date', 'is_lunch')
list_editable = ('is_lun... | 2.0625 | 2 |
src/oci/log_analytics/models/query_details.py | Manny27nyc/oci-python-sdk | 249 | 20289 | <gh_stars>100-1000
# coding: utf-8
# Copyright (c) 2016, 2021, Oracle and/or its affiliates. All rights reserved.
# This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LIC... | 1.859375 | 2 |
moist.py | phiriv/moisture_sensor | 0 | 20290 | <gh_stars>0
Script to read temperature data from the DHT11:
# Importeer Adafruit DHT bibliotheek.
import Adafruit_DHT
import time
als = True
while als:
humidity, temperature = Adafruit_DHT.read_retry(Adafruit_DHT.DHT11, 4) #on gpio pin 4 or pin 7
if humidity is not None and temperature is not None:
... | 3.53125 | 4 |
route_distances/utils/routes.py | general-synthesis/route-distances | 0 | 20291 | """ Module containing helper routines for routes """
from typing import Dict, Any, Set, List, Tuple
import numpy as np
from route_distances.utils.type_utils import StrDict
def calc_depth(tree_dict: StrDict, depth: int = 0) -> int:
"""
Calculate the depth of a route, recursively
:param tree_dict: the ro... | 3.34375 | 3 |
src/yafowil/tests/__init__.py | 2silver/yafowil | 8 | 20292 | from __future__ import print_function
from node.tests import NodeTestCase
from yafowil.base import factory
from yafowil.compat import IS_PY2
import lxml.etree as etree
import sys
import unittest
import yafowil.common
import yafowil.compound
import yafowil.persistence
import yafowil.table
if not IS_PY2:
from impor... | 2.109375 | 2 |
tools/foolbox/bim_attack.py | GianmarcoMidena/adversarial-ML-benchmarker | 0 | 20293 | <filename>tools/foolbox/bim_attack.py
from foolbox.attacks import LinfinityBasicIterativeAttack
from foolbox.criteria import Misclassification
from foolbox.distances import MSE
from tools.foolbox.adversarial_attack import AdversarialAttack
class BIMAttack(AdversarialAttack):
def __init__(self, model, step_size_i... | 2.171875 | 2 |
Tabuada.py | tobiaspontes/ScriptsPython | 0 | 20294 | # Tabuada em Python
def tabuada(x):
for i in range(10):
print('{} x {} = {}'.format(x, (i + 1), x * (i + 1)))
print()
if __name__ == '__main__':
print(9
)
nro = int(input('Entre com um número: '))
print(f'\n\033[1;32mTabuada do {nro}'+'\n')
tabuada(nro)
| 3.953125 | 4 |
radix_tree.py | mouradmourafiq/data-analysis | 17 | 20295 | <gh_stars>10-100
# -*- coding: utf-8 -*-
'''
Created on Dec 01, 2012
@author: <NAME>
About: This is an attempt to implement the radix tree algo.
Features :
-> insert
-> remove
-> search
'''
NOK = "{'':[]}"
class Prefixer():
def __init__(self):
self.__data = {}
def __repr__(self):
... | 3.671875 | 4 |
Python/PythonOOP/animals.py | JosephAMumford/CodingDojo | 2 | 20296 | <reponame>JosephAMumford/CodingDojo<gh_stars>1-10
class Animal(object):
def __init__(self,name,health):
self.name = name
self.health = 50
def walk(self):
self.health = self.health - 1
return self
def run(self):
self.health = self.health - 5
return self
... | 4.15625 | 4 |
ai4water/preprocessing/transformations/_wrapper.py | moonson619/AI4Water-1 | 17 | 20297 | <reponame>moonson619/AI4Water-1
from typing import Union, List, Dict
import numpy as np
import pandas as pd
from ai4water.utils.utils import jsonize, deepcopy_dict_without_clone
from ai4water.preprocessing.transformations import Transformation
class Transformations(object):
"""
While the [Transformation][a... | 3.125 | 3 |
main/tagcn_training.py | Stanislas0/KDD_CUP_2020_MLTrack2_SPEIT | 18 | 20298 | import os
import dgl
import time
import argparse
import numpy as np
import torch as th
import distutils.util
import torch.nn.functional as F
import utils
import models
import data_loader
os.environ["CUDA_VISIBLE_DEVICES"] = '0'
dev = th.device('cuda' if th.cuda.is_available() else 'cpu')
if __name__ == '__main__':
... | 2.015625 | 2 |
AltFS.py | g-mc/AltFS | 54 | 20299 | <reponame>g-mc/AltFS
#!/usr/bin/env python
"""
BSD 3-Clause License
Copyright (c) 2017, SafeBreach Labs
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the ... | 1.328125 | 1 |