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 |
|---|---|---|---|---|---|---|
backend-tests/tests/test_account_suspension.py | drewmoseley/integration | 0 | 11100 | <filename>backend-tests/tests/test_account_suspension.py<gh_stars>0
# Copyright 2020 Northern.tech AS
#
# 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
#
# https://www.apache.or... | 1.796875 | 2 |
src/RepairManager/rules/ecc_reboot_node_rule.py | RichardZhaoW/DLWorkspace | 2 | 11101 | import os, sys
sys.path.append(os.path.dirname(os.path.abspath(__file__)))
import json
import logging
import yaml
import requests
import time
from actions.migrate_job_action import MigrateJobAction
from actions.send_alert_action import SendAlertAction
from actions.reboot_node_action import RebootNodeAction
from action... | 1.875 | 2 |
work/dib-ipa-element/virtmedia-netconf/ironic-bmc-hardware-manager/src/ironic_bmc_hardware_manager/bmc.py | alexandruavadanii/ipa-deployer | 0 | 11102 | <gh_stars>0
# Copyright 2019 Nokia
#
# 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 wri... | 1.875 | 2 |
museum_site/context_processors.py | DrDos0016/z2 | 3 | 11103 | <reponame>DrDos0016/z2
from django.core.cache import cache
from datetime import datetime
from museum_site.models.detail import Detail
from museum_site.models.file import File
from museum_site.constants import TERMS_DATE
from museum_site.common import (
DEBUG, EMAIL_ADDRESS, BOOT_TS, CSS_INCLUDES, UPLOAD_CAP, env_... | 2.078125 | 2 |
misago/users/views/avatarserver.py | HenryChenV/iJiangNan | 1 | 11104 | <reponame>HenryChenV/iJiangNan
from django.contrib.auth import get_user_model
from django.contrib.staticfiles.templatetags.staticfiles import static
from django.shortcuts import redirect
from misago.conf import settings
UserModel = get_user_model()
def user_avatar(request, pk, size):
size = int(size)
try:... | 2.25 | 2 |
csbdeep/internals/nets.py | papkov/CSBDeep | 2 | 11105 | from __future__ import print_function, unicode_literals, absolute_import, division
from six.moves import range, zip, map, reduce, filter
from keras.layers import Input, Conv2D, Conv3D, Activation, Lambda
from keras.models import Model
from keras.layers.merge import Add, Concatenate
import tensorflow as tf
from keras i... | 2.171875 | 2 |
src/inf/runtime_data.py | feagi/feagi-core | 11 | 11106 | <filename>src/inf/runtime_data.py
parameters = {}
genome = {}
genome_stats = {}
genome_test_stats = []
brain = {}
cortical_list = []
cortical_map = {}
intercortical_mapping = []
block_dic = {}
upstream_neurons = {}
memory_list = {}
activity_stats = {}
temp_neuron_list = []
original_genome_id = []
fire_list = []
termina... | 1.765625 | 2 |
scripts/topo_countries.py | taufikhe/Censof-Mini-Project | 0 | 11107 | <reponame>taufikhe/Censof-Mini-Project
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import subprocess
from geonamescache import GeonamesCache
gc = GeonamesCache()
toposrc = '../data/states-provinces.json'
for iso2, country in gc.get_countries().items():
iso3 = country['iso3']
topojson = 'mapshaper -i {0} -f... | 2.234375 | 2 |
nordb/database/nordic2sql.py | MrCubanfrog/NorDB | 1 | 11108 | <reponame>MrCubanfrog/NorDB
"""
This module contains all information for pushing a NordicEvent object into the database.
Functions and Classes
---------------------
"""
import psycopg2
import os
import re
import datetime
from nordb.core import usernameUtilities
from nordb.database import creationInfo
INSERT_COMMAND... | 2.15625 | 2 |
movie_trailer_website/media.py | mradenovic/movie-trailer-website | 0 | 11109 | """This module contains class definitions for storing media files"""
import webbrowser
class Movie():
"""Movie class defines movies.
Attributes:
movie_title (str): Title of the movie
movie_storyline (str): Sort description of the movie
poster_image (str): Url of the poster image
... | 3.703125 | 4 |
201-vmss-bottle-autoscale/workserver.py | kollexy/azure-quickstart-templates | 10 | 11110 | <gh_stars>1-10
# workserver.py - simple HTTP server with a do_work / stop_work API
# GET /do_work activates a worker thread which uses CPU
# GET /stop_work signals worker thread to stop
import math
import socket
import threading
import time
from bottle import route, run
hostname = socket.gethostname()
hostport = 9000... | 3.328125 | 3 |
year_3/databases_sem1/lab1/cli.py | honchardev/KPI | 0 | 11111 | from maxdb import DB
def runtime_on_any_exception(func):
def decorate(*args, **kwargs):
try:
func(*args, **kwargs)
except:
raise RuntimeError
return decorate
class CLIUtils(object):
DEFAULT_PATH = 'storage.json'
def __init__(self):
self._db = None
... | 2.515625 | 3 |
Ar_Script/past/eg_用户信息用户界面.py | archerckk/PyTest | 0 | 11112 | <gh_stars>0
import easygui as g
# judge=1
# def judge_null(tmp):
# if tmp.isspace()or len(tmp)==0:
# return judge==0
#
# while 1:
# user_info=g.multenterbox(title='账号中心',
# msg='【*用户名】为必填项\t【*真实姓名】为必填项\t【*手机号码】为必填项\t【*E-mail】为必填项',
# fields=['*用户名','*真实姓名... | 2.453125 | 2 |
examples/pspm_pupil/model_defs.py | fmelinscak/cognibench | 3 | 11113 | from cognibench.models import CNBModel
from cognibench.capabilities import ContinuousAction, ContinuousObservation
from cognibench.continuous import ContinuousSpace
from cognibench.models.wrappers import MatlabWrapperMixin
class PsPMModel(MatlabWrapperMixin, CNBModel, ContinuousAction, ContinuousObservation):
nam... | 1.898438 | 2 |
core/layouts/pixel_list.py | TheGentlemanOctopus/oracle | 0 | 11114 | from layout import Layout
class PixelList(Layout):
"""
A simple generic layout, just a list of pixels
"""
def __init__(self, pixels):
"""
pixels is a list of pixel objects
"""
self.pixels = pixels
| 3.28125 | 3 |
test/programytest/clients/restful/test_config.py | minhdc/documented-programy | 0 | 11115 | import unittest
from programy.config.file.yaml_file import YamlConfigurationFile
from programy.clients.restful.config import RestConfiguration
from programy.clients.events.console.config import ConsoleConfiguration
class RestConfigurationTests(unittest.TestCase):
def test_init(self):
yaml = YamlConfigura... | 2.46875 | 2 |
Assignments/06.py | zexhan17/Data-Structures-and-Algorithms-using-Python | 0 | 11116 | # Write a recursive function to count the number of nodes in a Tree. (first do your self then see code)
def count_nodes(self):
count = 1
left_count = 0
right_count = 0
if self.left:
left_count = self.left.count_nodes()
if self.right:
right_count = self.right.count_nodes()
return count + left_count + rig... | 4.3125 | 4 |
flask_app.py | mdaeron/clumpycrunch | 0 | 11117 | <filename>flask_app.py
#! /usr/bin/env python3
# from datetime import datetime
# from random import choices
# from string import ascii_lowercase
from flask import Flask, request, render_template, Response, send_file
from flaskext.markdown import Markdown
from D47crunch import D47data, pretty_table, make_csv, smart_typ... | 2.15625 | 2 |
rubric_sampling/experiments/train_rnn.py | YangAzure/rubric-sampling-public | 20 | 11118 | r"""Train a neural network to predict feedback for a program string."""
from __future__ import division
from __future__ import print_function
from __future__ import absolute_import
import os
import sys
import random
import numpy as np
from tqdm import tqdm
import torch
import torch.optim as optim
import torch.utils.... | 2.34375 | 2 |
python/code.py | Warabhi/ga-learner-dsmp-repo | 0 | 11119 | <filename>python/code.py
# --------------
# Code starts here
class_1 = ['<NAME>' , '<NAME>' , '<NAME>' , '<NAME>']
class_2 = ['<NAME>' , '<NAME>' , '<NAME>']
new_class = class_1 + class_2
print(new_class)
new_class.append('<NAME>')
print(new_class)
del new_class[5]
print(new_class)
# Code ends here
# --------------
#... | 3.9375 | 4 |
checklog.py | mtibbett67/pymodules | 0 | 11120 | <reponame>mtibbett67/pymodules<gh_stars>0
#!/usr/bin/env python
# -*- coding: utf-8 -*-
'''
NAME:
checklog.py
DESCRIPTION:
This script checks the tail of the log file and lists the disk space
CREATED:
Sun Mar 15 22:53:54 2015
VERSION:
1.0
AUTHOR:
<NAME>
AUTHOR_EMAIL:
<EMAIL>
URL:
N/A
DOWNLOAD_URL:
N/A
INSTALL_... | 2.765625 | 3 |
algorithms/implementation/minimum_distances.py | avenet/hackerrank | 0 | 11121 | <filename>algorithms/implementation/minimum_distances.py
n = int(input().strip())
items = [
int(A_temp)
for A_temp
in input().strip().split(' ')
]
items_map = {}
result = None
for i, item in enumerate(items):
if item not in items_map:
items_map[item] = [i]
else:
items_map[item].ap... | 3.5625 | 4 |
spore/spore.py | pavankkota/SPoRe | 1 | 11122 | """
Sparse Poisson Recovery (SPoRe) module for solving Multiple Measurement Vector
problem with Poisson signals (MMVP) by batch stochastic gradient ascent and
Monte Carlo integration
Authors: <NAME>, <NAME>
Reference:
[1] <NAME>, <NAME>, <NAME>, and <NAME>, "Extreme Compressed
Sensing of Poisson Rates from Multip... | 2.34375 | 2 |
306/translate_cds.py | jsh/pybites | 0 | 11123 | """Use translation table to translate coding sequence to protein."""
from Bio.Data import CodonTable # type: ignore
from Bio.Seq import Seq # type: ignore
def translate_cds(cds: str, translation_table: str) -> str:
"""Translate coding sequence to protein.
:param cds: str: DNA coding sequence (CDS... | 3.203125 | 3 |
example.py | n0emis/pycodimd | 1 | 11124 | <gh_stars>1-10
from pycodimd import CodiMD
cmd = CodiMD('https://md.noemis.me')
#cmd.login('<EMAIL>','CorrectHorseBatteryStaple')
cmd.load_cookies()
print(cmd.history()[-1]['text']) # Print Name of latest Note
| 1.890625 | 2 |
PP4E-Examples-1.4/Examples/PP4E/System/Environment/echoenv.py | AngelLiang/PP4E | 0 | 11125 | <filename>PP4E-Examples-1.4/Examples/PP4E/System/Environment/echoenv.py
import os
print('echoenv...', end=' ')
print('Hello,', os.environ['USER'])
| 1.78125 | 2 |
plix/displays.py | freelan-developers/plix | 1 | 11126 | <reponame>freelan-developers/plix
"""
Display command results.
"""
from __future__ import unicode_literals
from contextlib import contextmanager
from argparse import Namespace
from io import BytesIO
from colorama import AnsiToWin32
from chromalog.stream import stream_has_color_support
from chromalog.colorizer impor... | 2.5625 | 3 |
plugins/Autocomplete/plugin.py | mogad0n/Limnoria | 476 | 11127 | <reponame>mogad0n/Limnoria
###
# Copyright (c) 2020-2021, The Limnoria Contributors
# 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.382813 | 1 |
utils/preprocess_twitter.py | arnavk/tumblr-emotions | 0 | 11128 | """
preprocess-twitter.py
python preprocess-twitter.py "Some random text with #hashtags, @mentions and http://t.co/kdjfkdjf (links). :)"
Script for preprocessing tweets by <NAME>
with small modifications by <NAME>
with translation to Python by <NAME>
Translation of Ruby script to create features for GloVe vectors for T... | 3.234375 | 3 |
pyPLANES/pw/pw_classes.py | matael/pyPLANES | 0 | 11129 | #! /usr/bin/env python
# -*- coding:utf8 -*-
#
# pw_classes.py
#
# This file is part of pyplanes, a software distributed under the MIT license.
# For any question, please contact one of the authors cited below.
#
# Copyright (c) 2020
# <NAME> <<EMAIL>>
# <NAME> <<EMAIL>>
# <NAME> <<EMAIL>>
#
# Permission is hereby g... | 1.976563 | 2 |
mmtbx/conformation_dependent_library/mcl.py | pcxod/cctbx_project | 0 | 11130 | <reponame>pcxod/cctbx_project<filename>mmtbx/conformation_dependent_library/mcl.py
from __future__ import absolute_import, division, print_function
import sys
import time
from cctbx.array_family import flex
from scitbx.math import superpose
from mmtbx.conformation_dependent_library import mcl_sf4_coordination
from six... | 1.9375 | 2 |
tests/test_install.py | dfroger/conda | 0 | 11131 | <gh_stars>0
from contextlib import contextmanager
import random
import shutil
import stat
import tempfile
import unittest
from os.path import join
from conda import install
from conda.install import (PaddingError, binary_replace, update_prefix,
warn_failed_remove, duplicates_to_remove)
fro... | 2.296875 | 2 |
django_elastic_appsearch/slicer.py | CorrosiveKid/django_elastic_appsearch | 11 | 11132 | <filename>django_elastic_appsearch/slicer.py<gh_stars>10-100
"""A Queryset slicer for Django."""
def slice_queryset(queryset, chunk_size):
"""Slice a queryset into chunks."""
start_pk = 0
queryset = queryset.order_by('pk')
while True:
# No entry left
if not queryset.filter(pk__gt=star... | 2.734375 | 3 |
newsite/news/urls.py | JasperStfun/Django_C | 0 | 11133 | <filename>newsite/news/urls.py<gh_stars>0
from django.urls import path
from . import views
urlpatterns = [
path('', views.news_home, name='news_home'),
path('create', views.create, name='create'),
path('<int:pk>', views.NewsDetailView.as_view(), name='news-detail'),
path('<int:pk>/update', views.NewsU... | 1.835938 | 2 |
module/phase_one/headers.py | cqr-cryeye-forks/Florid | 7 | 11134 | <reponame>cqr-cryeye-forks/Florid<filename>module/phase_one/headers.py
import requests
import lib.common
MODULE_NAME = 'headers'
def run():
r = requests.get(lib.common.SOURCE_URL)
# X-Forwarded-By:
if 'X-Powered-By' in r.headers:
lib.common.RESULT_ONE_DICT['X-Powered-By'] = r.headers['X-Powered... | 2.125 | 2 |
ekorpkit/io/fetch/edgar/edgar.py | entelecheia/ekorpkit | 4 | 11135 | import os
import requests
from bs4 import BeautifulSoup
from ekorpkit import eKonf
from ekorpkit.io.download.web import web_download, web_download_unzip
class EDGAR:
def __init__(self, **args):
self.args = eKonf.to_config(args)
self.base_url = self.args.base_url
self.url = self.args.url
... | 2.875 | 3 |
HARK/ConsumptionSaving/tests/test_PerfForesightConsumerType.py | michiboo/HARK | 0 | 11136 | from HARK.ConsumptionSaving.ConsIndShockModel import PerfForesightConsumerType
import numpy as np
import unittest
class testPerfForesightConsumerType(unittest.TestCase):
def setUp(self):
self.agent = PerfForesightConsumerType()
self.agent_infinite = PerfForesightConsumerType(cycles=0)
PF_... | 2.296875 | 2 |
src-gen/openapi_server/models/config.py | etherisc/bima-bolt-api | 0 | 11137 | <filename>src-gen/openapi_server/models/config.py
# coding: utf-8
from __future__ import absolute_import
from datetime import date, datetime # noqa: F401
from typing import List, Dict # noqa: F401
from openapi_server.models.base_model_ import Model
from openapi_server.models.component import Component
from openapi... | 2.234375 | 2 |
txt_annotation.py | bubbliiiing/classification-keras | 30 | 11138 | import os
from os import getcwd
#---------------------------------------------#
# 训练前一定要注意修改classes
# 种类顺序需要和model_data下的txt一样
#---------------------------------------------#
classes = ["cat", "dog"]
sets = ["train", "test"]
wd = getcwd()
for se in sets:
list_file = open('cls_' + se + '.txt', 'w')... | 2.6875 | 3 |
S4/S4 Library/simulation/relationships/sim_knowledge.py | NeonOcean/Environment | 1 | 11139 | <filename>S4/S4 Library/simulation/relationships/sim_knowledge.py
from protocolbuffers import SimObjectAttributes_pb2 as protocols
from careers.career_unemployment import CareerUnemployment
import services
import sims4
logger = sims4.log.Logger('Relationship', default_owner='jjacobson')
class SimKnowledge:
__slots... | 2.390625 | 2 |
233_number_of_digt_one.py | gengwg/leetcode | 2 | 11140 | <gh_stars>1-10
# Given an integer n, count the total number of digit 1 appearing
# in all non-negative integers less than or equal to n.
#
# For example:
# Given n = 13,
# Return 6, because digit 1 occurred in the following numbers:
# 1, 10, 11, 12, 13.
#
class Solution:
def countDigitOne(self, n):
"""
... | 3.828125 | 4 |
Search Algorithms.py | fzehracetin/A-Star-and-Best-First-Search | 1 | 11141 | from PIL import Image
from math import sqrt
import numpy as np
import time
import matplotlib.backends.backend_tkagg
import matplotlib.pyplot as plt
class Point:
x: float
y: float
f: float
h: float
g: float
def __init__(self, x, y, f):
self.x = x
self.y = y
... | 3.1875 | 3 |
time_test.py | Shb742/rnnoise_python | 32 | 11142 | #Author <NAME>
import time
import rnnoise
import numpy as np
def time_rnnoise(rounds=1000):
a = rnnoise.RNNoise()
timer = 0.0
st = time.time()
for i in range(rounds):
inp = np.random.bytes(960)
timer = (time.time() - st)
print(timer)
st = time.time()
for i in range(rounds):
inp = np.random.bytes(960)
va,o... | 2.875 | 3 |
tests/test_shell.py | jakubtyniecki/pact | 2 | 11143 |
""" shell sort tests module """
import unittest
import random
from sort import shell
from tests import helper
class ShellSortTests(unittest.TestCase):
""" shell sort unit tests class """
max = 100
arr = []
def setUp(self):
""" setting up for the test """
self.arr = random.sample(ran... | 3.625 | 4 |
k8s_apps/admin/dump_inventory_file.py | AkadioInc/firefly | 0 | 11144 | <filename>k8s_apps/admin/dump_inventory_file.py<gh_stars>0
import h5pyd
from datetime import datetime
import tzlocal
BUCKET="firefly-hsds"
inventory_domain = "/FIREfly/inventory.h5"
def formatTime(timestamp):
local_timezone = tzlocal.get_localzone() # get pytz timezone
local_time = datetime.fromtimestamp(time... | 2.484375 | 2 |
enaml/qt/qt_timer.py | xtuzy/enaml | 1,080 | 11145 | <reponame>xtuzy/enaml
#------------------------------------------------------------------------------
# Copyright (c) 2013-2017, Nucleic Development Team.
#
# Distributed under the terms of the Modified BSD License.
#
# The full license is in the file LICENSE, distributed with this software.
#--------------------------... | 1.882813 | 2 |
mindhome_alpha/erpnext/erpnext_integrations/doctype/mpesa_settings/test_mpesa_settings.py | Mindhome/field_service | 1 | 11146 | <filename>mindhome_alpha/erpnext/erpnext_integrations/doctype/mpesa_settings/test_mpesa_settings.py
# -*- coding: utf-8 -*-
# Copyright (c) 2020, Frappe Technologies Pvt. Ltd. and Contributors
# See license.txt
from __future__ import unicode_literals
from json import dumps
import frappe
import unittest
from erpnext.erp... | 1.71875 | 2 |
b2accessdeprovisioning/configparser.py | EUDAT-B2ACCESS/b2access-deprovisioning-report | 0 | 11147 | <reponame>EUDAT-B2ACCESS/b2access-deprovisioning-report<filename>b2accessdeprovisioning/configparser.py
from __future__ import absolute_import
import yaml
with open("config.yml", "r") as f:
config = yaml.load(f)
| 1.679688 | 2 |
res_mods/mods/packages/xvm_main/python/vehinfo_tiers.py | peterbartha/ImmunoMod | 0 | 11148 | <reponame>peterbartha/ImmunoMod<filename>res_mods/mods/packages/xvm_main/python/vehinfo_tiers.py
""" XVM (c) www.modxvm.com 2013-2017 """
# PUBLIC
def getTiers(level, cls, key):
return _getTiers(level, cls, key)
# PRIVATE
from logger import *
from gui.shared.utils.requesters import REQ_CRITERIA
from helpers im... | 2.015625 | 2 |
pypy/module/cpyext/test/test_pystrtod.py | m4sterchain/mesapy | 381 | 11149 | <filename>pypy/module/cpyext/test/test_pystrtod.py
import math
from pypy.module.cpyext import pystrtod
from pypy.module.cpyext.test.test_api import BaseApiTest, raises_w
from rpython.rtyper.lltypesystem import rffi
from rpython.rtyper.lltypesystem import lltype
from pypy.module.cpyext.pystrtod import PyOS_string_to_do... | 2.203125 | 2 |
mathics/core/systemsymbols.py | Mathics3/mathics-core | 90 | 11150 | <gh_stars>10-100
# -*- coding: utf-8 -*-
from mathics.core.symbols import Symbol
# Some other common Symbols. This list is sorted in alphabetic order.
SymbolAssumptions = Symbol("$Assumptions")
SymbolAborted = Symbol("$Aborted")
SymbolAll = Symbol("All")
SymbolAlternatives = Symbol("Alternatives")
SymbolAnd = Symbol(... | 2.296875 | 2 |
exercises/ali/cartpole-MCTS/cartpole.py | alik604/ra | 0 | 11151 | # from https://github.com/kvwoerden/mcts-cartpole
# ---------------------------------------------------------------------------- #
# Imports #
# ---------------------------------------------------------------------------- #
import os
import time
impor... | 1.984375 | 2 |
wildlifecompliance/components/applications/cron.py | preranaandure/wildlifecompliance | 1 | 11152 | from django_cron import CronJobBase, Schedule
class VerifyLicenceSpeciesJob(CronJobBase):
"""
Verifies LicenceSpecies against TSC server.
"""
RUN_AT_TIMES = ['00:00']
schedule = Schedule(run_at_times=RUN_AT_TIMES)
code = 'applications.verify_licence_species'
def do(self):
pass
| 2.046875 | 2 |
optional-plugins/CSVPlugin/CSVContext.py | owlfish/pubtal | 0 | 11153 | import ASV
from simpletal import simpleTAL, simpleTALES
try:
import logging
except:
import InfoLogging as logging
import codecs
class ColumnSorter:
def __init__ (self, columnList):
self.columnList = columnList
self.log = logging.getLogger ('ColumnSorter')
def setup (self, fieldNames):
mapList = []
fo... | 2.828125 | 3 |
wagtail/admin/forms/comments.py | stephiescastle/wagtail | 0 | 11154 | <reponame>stephiescastle/wagtail<gh_stars>0
from django.forms import BooleanField, ValidationError
from django.utils.timezone import now
from django.utils.translation import gettext as _
from .models import WagtailAdminModelForm
class CommentReplyForm(WagtailAdminModelForm):
class Meta:
fields = ("text",... | 2.21875 | 2 |
run_db_data.py | MahirMahbub/email-client | 0 | 11155 | <filename>run_db_data.py
import os
from sqlalchemy.orm import Session
from db.database import SessionLocal
class DbData:
def __init__(self):
self.root_directory: str = "db_merge_scripts"
self.scripts = [
"loader.sql"
]
def sync(self, db: Session):
for script in s... | 2.65625 | 3 |
scobra/analysis/compare_elements.py | nihalzp/scobra | 7 | 11156 |
def compareMetaboliteDicts(d1, d2):
sorted_d1_keys = sorted(d1.keys())
sorted_d2_keys = sorted(d2.keys())
for i in range(len(sorted_d1_keys)):
if not compareMetabolites(sorted_d1_keys[i], sorted_d2_keys[i], naive=True):
return False
elif not d1[sorted_d1_keys[i]] == d2[sorted_... | 2.609375 | 3 |
five/five_copy.py | ngd-b/python-demo | 1 | 11157 | <filename>five/five_copy.py<gh_stars>1-10
#!/usr/bin/python
# -*- coding:utf-8 -*-
print("hello world")
f = None
try:
f = open("./hello.txt","r",encoding="utf8")
print(f.read(5),end='')
print(f.read(5),end='')
print(f.read(5))
except IOError as e:
print(e)
finally:
if f:
f.close()
# w... | 3.546875 | 4 |
prepare_sets.py | mechtal/Vaccination_UK | 0 | 11158 | def prepare_sets(dataset, feature_columns, y_column):
train_X, val_X, train_y, val_y = train_test_split(dataset[feature_columns], dataset[y_column], random_state=1)
return train_X, val_X, train_y, val_y | 2.421875 | 2 |
examples/batch_ts_insert.py | bureau14/qdb-api-python | 9 | 11159 | # Copyright (c) 2009-2020, quasardb SAS. All rights reserved.
# 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 copyright
# notice,... | 1.539063 | 2 |
tests/backends/test_flashtext_backend.py | openredact/pii-identifier | 14 | 11160 | from nerwhal.backends.flashtext_backend import FlashtextBackend
from nerwhal.recognizer_bases import FlashtextRecognizer
def test_single_recognizer(embed):
class TestRecognizer(FlashtextRecognizer):
TAG = "XX"
SCORE = 1.0
@property
def keywords(self):
return ["abc", "c... | 2.515625 | 3 |
new_rdsmysql.py | AdminTurnedDevOps/AWS_Solutions_Architect_Python | 30 | 11161 | import boto3
import sys
import time
import logging
import getpass
def new_rdsmysql(dbname, instanceID, storage, dbInstancetype, dbusername):
masterPass = getpass.getpass('DBMasterPassword: ')
if len(masterPass) < 10:
logging.warning('Password is not at least 10 characters. Please try again')
... | 2.578125 | 3 |
src/tzscan/tzscan_block_api.py | Twente-Mining/tezos-reward-distributor | 0 | 11162 | <gh_stars>0
import random
import requests
from api.block_api import BlockApi
from exception.tzscan import TzScanException
from log_config import main_logger
logger = main_logger
HEAD_API = {'MAINNET': {'HEAD_API_URL': 'https://api%MIRROR%.tzscan.io/v2/head'},
'ALPHANET': {'HEAD_API_URL': 'http://api.alp... | 2.3125 | 2 |
python/cuxfilter/tests/charts/core/test_core_non_aggregate.py | Anhmike/cuxfilter | 201 | 11163 | import pytest
import cudf
import mock
from cuxfilter.charts.core.non_aggregate.core_non_aggregate import (
BaseNonAggregate,
)
from cuxfilter.dashboard import DashBoard
from cuxfilter import DataFrame
from cuxfilter.layouts import chart_view
class TestCoreNonAggregateChart:
def test_variables(self):
... | 2.078125 | 2 |
tunobase/tagging/migrations/0001_initial.py | unomena/tunobase-core | 0 | 11164 | <gh_stars>0
# -*- coding: utf-8 -*-
from south.utils import datetime_utils as datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding model 'Tag'
db.create_table(u'tagging_tag', (
... | 2.171875 | 2 |
recogym/envs/session.py | philomenec/reco-gym | 413 | 11165 | <reponame>philomenec/reco-gym
class Session(list):
"""Abstract Session class"""
def to_strings(self, user_id, session_id):
"""represent session as list of strings (one per event)"""
user_id, session_id = str(user_id), str(session_id)
session_type = self.get_type()
strings = []
... | 2.71875 | 3 |
message_handlers/location_handler.py | pratyushmore/lunch-tag-bot | 0 | 11166 | def location(messaging_adaptor, user, channel, location):
message = "Your location has been set to `{}`. You are ready to be matched for Lunch Tag :)".format(location)
messaging_adaptor.send_message(channel, message)
| 2.390625 | 2 |
b.py | lbarchive/b.py | 0 | 11167 | <gh_stars>0
#!/usr/bin/env python
# Copyright (C) 2013-2016 by <NAME>
#
# 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, ... | 1.359375 | 1 |
spyder/plugins/outlineexplorer/api.py | suokunlong/spyder | 1 | 11168 | # -*- coding: utf-8 -*-
#
# Copyright © Spyder Project Contributors
# Licensed under the terms of the MIT License
# (see spyder/__init__.py for details)
"""Outline explorer API.
You need to declare a OutlineExplorerProxy, and a function for handle the
edit_goto Signal.
class OutlineExplorerProxyCustom(OutlineExplore... | 2.515625 | 3 |
seamless/core/__init__.py | sjdv1982/seamless | 15 | 11169 | <filename>seamless/core/__init__.py
import weakref
class IpyString(str):
def _repr_pretty_(self, p, cycle):
return p.text(str(self))
class SeamlessBase:
_destroyed = False
_context = None
_cached_path = None
name = None
def _get_macro(self):
return self._context()._macro
@... | 2.203125 | 2 |
oguilem/configuration/config.py | dewberryants/oGUIlem | 2 | 11170 | import os
import re
import sys
from oguilem.configuration.fitness import OGUILEMFitnessFunctionConfiguration
from oguilem.configuration.ga import OGUILEMGlobOptConfig
from oguilem.configuration.geometry import OGUILEMGeometryConfig
from oguilem.configuration.utils import ConnectedValue, ConfigFileManager
from oguilem.... | 2.09375 | 2 |
xpd_workflow/temp_graph.py | CJ-Wright/xpd_workflow | 0 | 11171 | <filename>xpd_workflow/temp_graph.py
from __future__ import (division, print_function)
import matplotlib.cm as cmx
import matplotlib.colors as colors
from matplotlib import gridspec
from metadatastore.api import db_connect as mds_db_connect
from filestore.api import db_connect as fs_db_connect
fs_db_connect(
**{... | 2 | 2 |
winnow/core.py | bgschiller/winnow | 3 | 11172 | from __future__ import unicode_literals
import copy
import json
from six import string_types
from . import default_operators
from . import sql_prepare
from . import values
from .error import WinnowError
from .templating import SqlFragment
from .templating import WinnowSql
class Winnow(object):
"""
Winnow is... | 2.359375 | 2 |
ibis/bigquery/client.py | tswast/ibis | 0 | 11173 | import regex as re
import time
import collections
import datetime
import six
import pandas as pd
import google.cloud.bigquery as bq
from multipledispatch import Dispatcher
import ibis
import ibis.common as com
import ibis.expr.operations as ops
import ibis.expr.types as ir
import ibis.expr.schema as sch
import ibis... | 1.992188 | 2 |
5 kyu/Family Tree Ancestors.py | mwk0408/codewars_solutions | 6 | 11174 | <filename>5 kyu/Family Tree Ancestors.py<gh_stars>1-10
from math import log, ceil
def chart(person):
res=helper(tuple(sorted(person.parents(), key=lambda x: x.sex, reverse=True)), 2, [], 16, 16)
res.append((person.name, 16))
dict={j:i for i,j in res}
dict2=helper2(16)
chart=[]
for i in range(1,... | 3.03125 | 3 |
tests/make_expected_lookup.py | bfis/coffea | 77 | 11175 | import numpy as np
import ROOT
from dummy_distributions import dummy_pt_eta
counts, test_in1, test_in2 = dummy_pt_eta()
f = ROOT.TFile.Open("samples/testSF2d.root")
sf = f.Get("scalefactors_Tight_Electron")
xmin, xmax = sf.GetXaxis().GetXmin(), sf.GetXaxis().GetXmax()
ymin, ymax = sf.GetYaxis().GetXmin(), sf.GetYax... | 1.851563 | 2 |
engine/sentiment_analysis.py | zgeorg03/nesase | 2 | 11176 | <filename>engine/sentiment_analysis.py
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Wed Mar 14 17:42:27 2018
@author: zgeorg03
"""
import re
import json # Used for converting json to dictionary
import datetime # Used for date conversions
import matplotlib.pyplot as plt
import numpy as np
from sentim... | 2.75 | 3 |
ch05/recursion.py | laszlokiraly/LearningAlgorithms | 74 | 11177 | """Recursive implementations."""
def find_max(A):
"""invoke recursive function to find maximum value in A."""
def rmax(lo, hi):
"""Use recursion to find maximum value in A[lo:hi+1]."""
if lo == hi: return A[lo]
mid = (lo+hi) // 2
L = rmax(lo, mid)
R = rmax(mid+1, hi)
... | 4.03125 | 4 |
setup.py | koonimaru/DeepGMAP | 11 | 11178 | #from distutils.core import setup
from setuptools import setup, find_packages
from distutils.extension import Extension
import re
import os
import codecs
here = os.path.abspath(os.path.dirname(__file__))
def read(*parts):
# intentionally *not* adding an encoding option to open, See:
# https://github.com/pyp... | 1.96875 | 2 |
{{cookiecutter.project_slug}}/api/__init__.py | Steamboat/cookiecutter-devops | 0 | 11179 |
import logging
from flask import Flask
from flask_sqlalchemy import SQLAlchemy as _BaseSQLAlchemy
from flask_migrate import Migrate
from flask_cors import CORS
from flask_talisman import Talisman
from flask_ipban import IpBan
from config import Config, get_logger_handler
# database
class SQLAlchemy(_BaseSQLAlchemy):... | 2.125 | 2 |
weibospider/pipelines.py | czyczyyzc/WeiboSpider | 2 | 11180 | <filename>weibospider/pipelines.py
# -*- coding: utf-8 -*-
import os
import csv
import pymongo
from pymongo.errors import DuplicateKeyError
from settings import MONGO_HOST, MONGO_PORT, SAVE_ROOT
class MongoDBPipeline(object):
def __init__(self):
client = pymongo.MongoClient(MONGO_HOST, MONGO_PORT)
... | 2.6875 | 3 |
tests/test_gc3_config.py | ericmharris/gc3-query | 0 | 11181 | from pathlib import Path
from requests.auth import _basic_auth_str
import pytest
from bravado_core.formatter import SwaggerFormat, NO_OP
from gc3_query.lib.gc3_config import GC3Config, IDMCredential
TEST_BASE_DIR: Path = Path(__file__).parent.joinpath("GC3Config")
config_dir = TEST_BASE_DIR.joinpath("config")
def te... | 1.914063 | 2 |
lab6/server/datapredict.py | zhiji95/iot | 2 | 11182 | <reponame>zhiji95/iot<filename>lab6/server/datapredict.py
import machine
from machine import *
import ssd1306
import time
import socket
import urequests as requests
import json
word = {'body':8}
labels = ['c', 'o', 'l', 'u', 'm', 'b', 'i', 'a','null']
HOST = '192.168.127.12'
PORT = 8080
flag = 0
stop = False
data = {}... | 2.796875 | 3 |
Geometry/VeryForwardGeometry/python/dd4hep/geometryRPFromDD_2021_cfi.py | PKUfudawei/cmssw | 2 | 11183 | <gh_stars>1-10
from Geometry.VeryForwardGeometry.dd4hep.v5.geometryRPFromDD_2021_cfi import *
| 1.007813 | 1 |
examples/plots/warmup_schedule.py | shuoyangd/pytorch_warmup | 170 | 11184 | import argparse
import matplotlib.pyplot as plt
import torch
from pytorch_warmup import *
def get_rates(warmup_cls, beta2, max_step):
rates = []
p = torch.nn.Parameter(torch.arange(10, dtype=torch.float32))
optimizer = torch.optim.Adam([{'params': p}], lr=1.0, betas=(0.9, beta2))
lr_scheduler = torch.... | 2.53125 | 3 |
plugins/httpev.py | wohali/gizzy | 3 | 11185 | <reponame>wohali/gizzy
"""\
This plugin merely enables other plugins to accept data over HTTP. If
a plugin defines a module level function named "httpev" it will be
invoked for POST requests to the url http://$hostname/event/$pluginname.
The function is invoked from the thread in the web.py request context
and as such ... | 2.421875 | 2 |
ex056.py | danilodelucio/Exercicios_Curso_em_Video | 0 | 11186 | somaIdade = 0
maiorIdade = 0
nomeVelho = ''
totmulher20 = 0
for p in range(1, 3):
print('---- {}ª PESSOA ----'.format(p))
nome = str(input('Nome: ')).strip()
idade = int(input('Idade: '))
sexo = str(input('Sexo [M/F]: '))
somaIdade += idade
if p == 1 and sexo in 'Mm':
maiorIdade = idade
... | 3.6875 | 4 |
python/promort.py | simleo/promort_pipeline | 0 | 11187 | """\
PROMORT example.
"""
import argparse
import random
import sys
import pyecvl.ecvl as ecvl
import pyeddl.eddl as eddl
from pyeddl.tensor import Tensor
import models
def VGG16(in_layer, num_classes):
x = in_layer
x = eddl.ReLu(eddl.Conv(x, 64, [3, 3]))
x = eddl.MaxPool(eddl.ReLu(eddl.Conv(x, 64, [3, ... | 2.4375 | 2 |
src/view/services_update_page.py | nbilbo/services_manager | 0 | 11188 | from src.view.services_page import ServicesPage
from src.view.services_add_page import ServicesAddPage
class ServicesUpdatePage(ServicesAddPage):
def __init__(self, parent, *args, **kwargs):
super().__init__(parent, *args, **kwargs)
self.set_title("Update service")
self.set_confirm_button_... | 1.984375 | 2 |
Lib/site-packages/wagtail/utils/l18n/translation.py | SyahmiAmin/belikilo | 0 | 11189 | <filename>Lib/site-packages/wagtail/utils/l18n/translation.py<gh_stars>0
import os
import gettext
import bisect
from locale import getdefaultlocale
from collections.abc import MutableMapping
from copy import copy, deepcopy
import six
class Trans:
def __init__(self):
self.registry = {}
self.curre... | 2.15625 | 2 |
playground/sockets/server.py | tunki/lang-training | 0 | 11190 | import socket
s = socket.socket()
s.bind(("localhost", 9999))
s.listen(1)
sc, addr = s.accept()
while True:
recibido = sc.recv(1024)
if recibido == "quit":
break
print "Recibido:", recibido
sc.send(recibido)
print "adios"
sc.close()
s.close()
| 2.890625 | 3 |
examples/example_contour.py | moghimis/geojsoncontour | 63 | 11191 | <filename>examples/example_contour.py
import numpy
import matplotlib.pyplot as plt
import geojsoncontour
# Create lat and lon vectors and grid data
grid_size = 1.0
latrange = numpy.arange(-90.0, 90.0, grid_size)
lonrange = numpy.arange(-180.0, 180.0, grid_size)
X, Y = numpy.meshgrid(lonrange, latrange)
Z = numpy.sqrt(... | 3.40625 | 3 |
Graphs/ConnectedComponents.py | PK-100/Competitive_Programming | 70 | 11192 | #!/bin/python3
import math
import os
import random
import re
import sys
#
# Complete the 'countGroups' function below.
#
# The function is expected to return an INTEGER.
# The function accepts STRING_ARRAY related as parameter.
#
class Graph:
def __init__(self, V):
self.V = V
self.adj = [[] for ... | 4.03125 | 4 |
recognition/ml_model.py | hurschler/pig-face-recognition | 1 | 11193 | <reponame>hurschler/pig-face-recognition
import logging.config
import util.logger_init
import numpy as np
import tensorflow as tf
from sklearn.metrics import confusion_matrix
from util.tensorboard_util import plot_confusion_matrix, plot_to_image
from tensorflow.python.keras.callbacks_v1 import TensorBoard
from keras im... | 2.734375 | 3 |
requests/UpdateSubscriptionRequest.py | divinorum-webb/python-tableau-api | 1 | 11194 | <gh_stars>1-10
from .BaseRequest import BaseRequest
class UpdateSubscriptionRequest(BaseRequest):
"""
Update subscription request for generating API request URLs to Tableau Server.
:param ts_connection: The Tableau Server connection object.
:type ts_connection: class
... | 2.640625 | 3 |
doc/examples/cython/cython_main.py | hershg/ray | 2 | 11195 | <filename>doc/examples/cython/cython_main.py
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import ray
import click
import inspect
import numpy as np
import cython_examples as cyth
def run_func(func, *args, **kwargs):
"""Helper function for running e... | 2.75 | 3 |
Simon/dev/main_age_classification.py | uncharted-distil/simon | 0 | 11196 | <gh_stars>0
from DataGenerator import *
from Encoder import *
import pandas as pd
from keras.models import Model
from keras.layers import Dense, Activation, Flatten, Input, Dropout, MaxPooling1D, Convolution1D
from keras.layers import LSTM, Lambda, merge, Masking
from keras.layers import Embedding, TimeDistributed
from... | 2.46875 | 2 |
desdeo_tools/solver/__init__.py | phoopies/desdeo-tools | 1 | 11197 | """This module implements methods for solving scalar valued functions.
"""
__all__ = ["DiscreteMinimizer", "ScalarMethod", "ScalarMinimizer", "ScalarSolverException"]
from desdeo_tools.solver.ScalarSolver import DiscreteMinimizer, ScalarMethod, ScalarMinimizer, ScalarSolverException
| 1.570313 | 2 |
tests/test_root_to_hdf.py | lundeenj/hawc_hal | 0 | 11198 | from hawc_hal.maptree.map_tree import map_tree_factory
from hawc_hal.response import hawc_response_factory
import os
from conftest import check_map_trees, check_responses
def test_root_to_hdf_response(response):
r = hawc_response_factory(response)
test_filename = "response.hd5"
# Make sure it doesn't e... | 2.3125 | 2 |
clickhouse_driver/compression/zstd.py | risicle/clickhouse-driver | 17 | 11199 | from __future__ import absolute_import
from io import BytesIO
import zstd
from .base import BaseCompressor, BaseDecompressor
from ..protocol import CompressionMethod, CompressionMethodByte
from ..reader import read_binary_uint32
from ..writer import write_binary_uint32, write_binary_uint8
class Compressor(BaseCompr... | 2.484375 | 2 |