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 |
|---|---|---|---|---|---|---|
2-python-intermediario (Programacao Procedural)/aula01-funcoes/exercicio2.py | Leodf/projetos-python | 0 | 12789251 | <reponame>Leodf/projetos-python
"""
Crie uma função 1 que recebe uma função 2 como parâmetro e retorne o valor da função2 executada.
"""
def ola_mundo():
return 'Olá mundo!'
def mestre(funcao):
return funcao()
executando = mestre(ola_mundo)
print(executando)
"""
Crie uma função1 que recebe uma função2 como ... | 3.578125 | 4 |
alluka/__init__.py | FasterSpeeding/Alluka | 9 | 12789252 | <gh_stars>1-10
# -*- coding: utf-8 -*-
# cython: language_level=3
# BSD 3-Clause License
#
# Copyright (c) 2020-2022, Faster Speeding
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistri... | 1.375 | 1 |
Python/code case/code case 26.py | amazing-2020/pdf | 3 | 12789253 | <gh_stars>1-10
import random
def number():
return int(input('Enter a number: '))
i = 0
a = random.randint(-10, 100)
while True:
i += 1
b = number()
if a > b:
print('Number too small: ')
elif a < b:
print('Number too big: ')
else:
print('After %d times you succeed get ... | 3.796875 | 4 |
classify_images.py | bw4sz/SpeciesClassification | 0 | 12789254 | #######
#
# classify_images.py
#
# This is a test driver for running our species classifiers and detectors.
# The script classifies one or more hard-coded image files.
#
# Because the inference code has not been assembled into a formal package yet,
# you should define API_ROOT to point to the base of our repo. This
# ... | 2.140625 | 2 |
xml2csv.py | LynnChan706/object_detection_auto | 0 | 12789255 | #!/usr/bin/env python3.5
# coding=utf-8
'''
@date = '17/12/1'
@author = 'lynnchan'
@email = '<EMAIL>'
'''
import os
import glob
import pandas as pd
import xml.etree.ElementTree as ET
from gconfig import *
train_path = Train_Data_Path
test_path = Test_Data_Path
def xml_to_csv(path):
xml_list =... | 3 | 3 |
notebooks/method_comp_c.py | nedlrichards/tau_decomp | 0 | 12789256 | <reponame>nedlrichards/tau_decomp
from scipy.io import loadmat
import gsw
import numpy as np
import matplotlib.pyplot as plt
from src import Config, lvl_profiles, grid_field, Section, SA_CT_from_sigma0_spiciness0
plt.ion()
cf = Config()
# sound speed comparison
all_lvls = np.load('data/processed/inputed_decomp.npz')... | 1.929688 | 2 |
tests/auth/test_auth.py | nabetama/slacky | 3 | 12789257 | from tests.test_common import TestSlack
class TestAuth(TestSlack):
def test_auth(self):
assert self.slack.auth
def test_auth_test(self):
assert self.slack.auth.test
def test_auth_test_response(self):
assert self.slack.auth.test.status_code == 200
| 2.078125 | 2 |
tests/fit_simulaid.py | hassnabdl/Helix-Analysis-Program | 1 | 12789258 | <gh_stars>1-10
import numpy as np
def fit_simulaid(phi):
"""
DEPRECATED AND WORKING FOR SMALL NUMBER OF SAMPLES
--
Fit theta such as:
phi_i = theta * i + phi_0 (E)
Solving the system:
| SUM(E)
| SUM(E*i for i)
that can be written:
| a11 * theta + a12 * phi_0 =... | 3.375 | 3 |
cogs/utils/resolver.py | Lazyuki/DiscordStatsBotPython | 2 | 12789259 | <reponame>Lazyuki/DiscordStatsBotPython<filename>cogs/utils/resolver.py
import discord
import re
import shlex
ID_REGEX = re.compile(r'([0-9]{15,21})>?\b')
# Can access members with dots
def Map(dict):
__getattr__ = dict.get
__setattr__ = dict.__setitem__
__delattr__ = dict.__delitem__
def has_role(member... | 2.40625 | 2 |
common/models/generators.py | Aixile/chainer-gan-experiments | 70 | 12789260 | import numpy as np
import math
import chainer
import chainer.functions as F
import chainer.links as L
from chainer import cuda, optimizers, serializers, Variable
from chainer import function
from chainer.utils import type_check
from .ops import *
class DCGANGenerator(chainer.Chain):
def __init__(self, latent=128,... | 2.078125 | 2 |
python_practice/python_tricks/chp3/args_kwargs/example_3_return_nothing.py | sokunmin/deep_learning_practices | 0 | 12789261 | def foo(value):
if value:
return value
else:
return None
def foo2(value):
"""Bare return statement implies `return None`"""
if value:
return value
else:
return
def foo3(value):
"""Missing return statement implies `return None`"""
if value:
return v... | 3.9375 | 4 |
start.py | TrixiS/base-bot | 0 | 12789262 | <reponame>TrixiS/base-bot<filename>start.py
import os
import platform
from pathlib import Path
SYSTEM = platform.system()
root_path = Path(__file__).parent
os.chdir(str(root_path.absolute()))
def install_dependencies():
requirements_path = root_path / "requirements.txt"
if SYSTEM == "Windows":
inst... | 2.34375 | 2 |
merge_csv.py | jfilter/wikipedia-edits-verified-accounts | 6 | 12789263 | import csv
from pathlib import Path
folder = 'recent_changes'
all_csv = [pth for pth in Path(folder).iterdir()
if pth.suffix == '.csv']
header = None
rows = []
for f_csv in all_csv:
with open(f_csv) as csvfile:
reader = csv.reader(csvfile)
header = next(reader) # read header
... | 3.109375 | 3 |
ex067.py | Jordemar-D-Bousquet/Exercicios_Python | 0 | 12789264 | <reponame>Jordemar-D-Bousquet/Exercicios_Python
# Faça um programa que mostre a tabuada de vários números, um de cada vez, para cada valor digitado pelo usuário.
# O programa será interrompido quando o número solicitado for negativo.
while True:
n = int(input('Digite um número para ver a sua tabuada ou um número n... | 3.96875 | 4 |
src/compas/datastructures/network/_network.py | kathrindoerfler/compas | 0 | 12789265 | <reponame>kathrindoerfler/compas<filename>src/compas/datastructures/network/_network.py
from __future__ import print_function
from __future__ import absolute_import
from __future__ import division
from compas.datastructures.network.core import BaseNetwork
from compas.datastructures.network.core import network_split_ed... | 2.296875 | 2 |
primeiros-exercicios/lpc072.py | miguelsndc/PythonFirstLooks | 1 | 12789266 | <gh_stars>1-10
menor = 0
for c in range(0, 3):
produto = float(input('Digite o preço dos Produtos: '))
menor = produto
if produto < menor:
menor = produto
print(f'Você deve optar pelo produto de {menor}, pois ele é o mais barato.') | 3.9375 | 4 |
simple.py | pythonflaskserverapps/helloworld | 0 | 12789267 | #############################################
# global imports
from http.server import BaseHTTPRequestHandler, HTTPServer
from urllib.parse import unquote
import sys
import os
import json
#############################################
#############################################
# local imports
from serverutils import... | 2.328125 | 2 |
migrations/versions/3b6e7f250153_update_trello_url_type.py | palazzem/gello | 44 | 12789268 | <gh_stars>10-100
# -*- coding: utf-8 -*-
#
# Unless explicitly stated otherwise all files in this repository are licensed
# under the Apache 2 License.
#
# This product includes software developed at Datadog
# (https://www.datadoghq.com/).
#
# Copyright 2018 Datadog, Inc.
#
"""Update trello_url type.
Revision ID: 3b... | 1.703125 | 2 |
word_count.py | Noahs-ARK/idea_relations | 29 | 12789269 | <reponame>Noahs-ARK/idea_relations
# -*- coding: utf-8 -*-
import collections
import re
import io
import gzip
import json
import functools
import logging
import numpy as np
import scipy.stats as ss
from nltk.corpus import stopwords
import utils
STOPWORDS = set(stopwords.words("english") + ["said"])
def get_ngram_lis... | 2.84375 | 3 |
hidden.py | KangaroosInAntarcitica/TwitterMap | 0 | 12789270 | # Keep this file separate
# https://apps.twitter.com/
# Create new App and get the four strings
def oauth():
return {"consumer_key": "ejp9meWGxr5g1jH5qZozgvUwB",
"consumer_secret": "<KEY>",
"token_key": "<KEY>",
"token_secret": "<KEY>"}
| 2.421875 | 2 |
Bugscan_exploits-master/exp_list/exp-602.py | csadsl/poc_exp | 11 | 12789271 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
__author__ = 'tyq'
# Name: Wordpress Work the flow file upload 2.5.2 Shell Upload Vulnerability
# Refer: https://www.bugscan.net/#!/x/21599
def assign(service, arg):
if service == "wordpress":
return True, arg
def audit(arg):
p... | 2.296875 | 2 |
examples/create_scripts/extensions/e-interval.py | bendichter/api-python | 32 | 12789272 | <gh_stars>10-100
# Definitions of extension to IntervalSeries
# "isc" is the schema id (or 'namespace')
# "fs" must always be the top level key
{"fs": {"isc": {
"info": {
"name": "Interval series code descriptions",
"version": "1.0",
"date": "April 7, 2016",
"author": "<NAME>",
"contact": "<EMAIL... | 1.164063 | 1 |
consumer_c.py | tobiaslory/Streaming-with-Kafka | 0 | 12789273 | <filename>consumer_c.py
from kafka import KafkaConsumer
if __name__ == '__main__':
kafka_consumer = KafkaConsumer('numbers')
for msg in kafka_consumer:
print(msg.key.decode("utf-8"), int.from_bytes(msg.value, byteorder='big')) | 2.6875 | 3 |
core/page/todo/todo.py | gangadhar-kadam/sapphite_lib | 0 | 12789274 | <reponame>gangadhar-kadam/sapphite_lib<filename>core/page/todo/todo.py
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd.
# MIT License. See license.txt
from __future__ import unicode_literals
import webnotes
from webnotes.model.doc import Document
@webnotes.whitelist()
def get(arg=None):
"""get todo list"""
re... | 2.125 | 2 |
podpac/datalib/nasaCMR.py | creare-com/podpac | 46 | 12789275 | """
Search using NASA CMR
"""
from __future__ import division, unicode_literals, print_function, absolute_import
import json
import logging
import requests
import numpy as np
_logger = logging.getLogger(__name__)
from podpac.core.utils import _get_from_url
CMR_URL = r"https://cmr.earthdata.nasa.gov/search/"
def ... | 3.0625 | 3 |
client/dvaclient/constants.py | ysglh/DeepVideoAnalytics | 3 | 12789276 | TYPE_QUERY_CONSTANT = 'Q'
TYPE_PROCESSING_CONSTANT = 'V'
| 1.03125 | 1 |
scripts/neo4j-delete_all.py | t-umeno/find_udp_server | 0 | 12789277 | <reponame>t-umeno/find_udp_server
#!/usr/bin/python
from neo4j.v1 import GraphDatabase, basic_auth
password = "<PASSWORD>"
driver = GraphDatabase.driver("bolt://localhost:7687", auth=basic_auth("neo4j", password))
session = driver.session()
result = session.run("MATCH (n) OPTIONAL MATCH (n)-[r]-() DELETE n,r")
sess... | 2.09375 | 2 |
Python/Topics/BeautifulSoup/Get the title/main.py | drtierney/hyperskill-problems | 5 | 12789278 | import requests
from bs4 import BeautifulSoup
url = input()
r = requests.get(url)
soup = BeautifulSoup(r.content, 'html.parser')
print(soup.find("h1").text)
| 3.28125 | 3 |
exercicios/ex036.py | LucasLima337/CEV_Python_Exercicios | 0 | 12789279 | <gh_stars>0
# Aprovando Empréstimo
import time
n = str(input('\033[1;30mDigite seu nome completo: ')).strip().title()
vc = float(input('Digite o valor da casa: R$'))
s = float(input('Digite o seu salário: R$'))
a = int(input('Digite por quantos anos irá pagar: '))
prest = vc / (a * 12)
print('')
print(f'Olá, {n.split()... | 3.328125 | 3 |
scaladecore/__init__.py | guiloga/scaladecore | 0 | 12789280 | <gh_stars>0
from .managers import ContextManager
import os
def scalade_func(func):
def execute(*args, **kwargs):
SCALADE_FI_TOKEN = os.getenv('SCALADE_FI_TOKEN')
context = ContextManager.initialize_from_token(SCALADE_FI_TOKEN)
return func(context)
return execute
| 1.851563 | 2 |
process/pkg/src/song_lyrics/util.py | edublancas/song-lyrics | 6 | 12789281 | <reponame>edublancas/song-lyrics
import os
import yaml
from pkg_resources import resource_filename
def load_yaml_asset(path):
"""
Load a yaml located in the assets folder
by specifying a relative path to the assets/ folder
"""
relative_path = os.path.join('assets', path)
absolute_path = resour... | 3.0625 | 3 |
votakvot/resumable.py | allegro/votakvot | 2 | 12789282 | <gh_stars>1-10
from __future__ import annotations
import abc
import datetime
import time
from typing import Any, Dict, Optional, Union
import votakvot
class resumable_fn(abc.ABC):
snapshot_each: Optional[int] = None
snapshot_period: Union[datetime.timedelta, float, None] = None
def __init__(self, *ar... | 2.34375 | 2 |
Inventationery/apps/PurchOrder/migrations/0006_auto_20151220_2213.py | alexharmenta/Inventationery | 0 | 12789283 | <filename>Inventationery/apps/PurchOrder/migrations/0006_auto_20151220_2213.py
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('PurchOrder', '0005_auto_20151220_2126'),
]
operations... | 1.382813 | 1 |
src/url_handlers.py | MarkHershey/paperbot | 0 | 12789284 | <reponame>MarkHershey/paperbot
# built-in modules
import re
from pathlib import Path
from typing import Dict, List, Tuple
# external modules
from markkk.logger import logger
__all__ = ["process_url"]
def process_url(url: str) -> Dict[str, str]:
if "arxiv.org" in url:
src_website = "arxiv"
paper_... | 2.359375 | 2 |
uitwerkingen/2-2darrays.py | harcel/PyDataScienceIntroNL | 0 | 12789285 | <filename>uitwerkingen/2-2darrays.py
arr = np.random.randint(0, 10, size=(5,3))
print(arr)
arr_reshaped = arr.reshape((3,5))
print(arr_reshaped)
print()
print(arr.sum(axis=0))
print(arr_reshaped.sum(axis=1)) # Deze zijn niet hetzelfde. De arrays zijn dezelfde als je van links naar rechts van boven naar beneden leest.
... | 3.484375 | 3 |
main.py | ShaunJorstad/Number-Puzzle-Solver | 0 | 12789286 | <reponame>ShaunJorstad/Number-Puzzle-Solver
from board import Board
import os
def prompt(validInput, promptTitle, default):
'''
prompts the user based on the provided options repeatedly until a valid value is selected, and then returned
'''
userInput = 'null'
while userInput not in validInput.keys... | 3.921875 | 4 |
fonctions.py | ImadEM21/win-one | 0 | 12789287 | <filename>fonctions.py
import re, string, unicodedata
import nltk
from bs4 import BeautifulSoup
from nltk import word_tokenize, sent_tokenize
from nltk.corpus import stopwords
from nltk.stem import LancasterStemmer, WordNetLemmatizer
from nltk.stem import PorterStemmer
from sklearn.feature_extraction.text import Tfidf... | 1.929688 | 2 |
config/admin.py | 2019342a/improved-enigma | 0 | 12789288 | <gh_stars>0
from django.contrib import admin
class SkorAdmin(admin.AdminSite):
site_title = "Skor"
site_header = "Skor"
index_title = "Skor administration"
site_url = None
| 1.3125 | 1 |
datasets/nmr_wine/__init__.py | ryuzakyl/data-bloodhound | 3 | 12789289 | #!/usr/bin/env
# -*- coding: utf-8 -*-
# Copyright (C) <NAME> - All Rights Reserved
# Unauthorized copying of this file, via any medium is strictly prohibited
# Proprietary and confidential
# Written by <NAME> <<EMAIL>>, January 2017
import os
import numpy as np
import pandas as pd
import scipy.io as sio
import util... | 2.578125 | 3 |
footer/menus/__init__.py | AutomataRaven/azaharTEA | 5 | 12789290 | __all__ = ['highlightmenu.HighlightMenu','highlightmenu.HighligthStyleMenu']
| 1.101563 | 1 |
run_game.py | hdaftary/Flappy-Birds | 0 | 12789291 | import pygame
import flappy
from thread import callback
import speech_recognition as sr
import sys
if __name__ == '__main__':
if len(sys.argv) == 3 and sys.argv[2] == "False":
r = sr.Recognizer()
m = sr.Microphone()
with m as source:
r.adjust_for_ambient_noise(source) # we only... | 3.140625 | 3 |
aws_network_tap/tap.py | vectranetworks/AWS-Session-Mirroring-Tool | 3 | 12789292 | <gh_stars>1-10
"""
AWS Network Tapping Tool
For installing AWS Session Mirroring on Eligible Nitro instances.
Took takes a "tap everything" approach at the VPC level.
Specific instances can be opted out with the blacklist tool.
"""
import logging
from aws_network_tap.models.ec2_api_client import Ec2ApiClient, VPC_Pro... | 2 | 2 |
credoscript/contrib/chemblws.py | tlb-lab/credoscript | 0 | 12789293 | <gh_stars>0
import json
from urllib import urlencode
from urllib2 import quote, urlopen, HTTPError, URLError
class ChEMBLWS(object):
'''
'''
def __init__(self):
'''
'''
self._url = "https://www.ebi.ac.uk/chemblws/{entity}/{target}/{query}.json"
def _get_instance(self, entity, t... | 3.125 | 3 |
baekjoon/python/complete_binary_tree_3038.py | yskang/AlgorithmPracticeWithPython | 0 | 12789294 | <gh_stars>0
# Title: 완전 이진 트리
# Link: https://www.acmicpc.net/problem/3038
import sys
sys.setrecursionlimit(10 ** 6)
read_single_int = lambda: int(sys.stdin.readline().strip())
def f(x: int, y: int, n: int):
if y == (1 << n - 1):
print(y*3-1-x)
return
print(x)
f(x+y, ... | 3.21875 | 3 |
xls/solvers/python/lec_characterizer_test.py | ted-xie/xls | 0 | 12789295 | <filename>xls/solvers/python/lec_characterizer_test.py
# Lint as: python3
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/L... | 2.3125 | 2 |
banking/utils.py | justmytwospence/banking-oop | 0 | 12789296 | <filename>banking/utils.py
import logging
logger = logging.getLogger(__name__)
def split_name(name):
try:
names = name.split(" ")
assert len(names) == 2
return names[0], names[1]
except Exception as e:
logger.error(f"Only one first and last name supported.")
return Non... | 3.1875 | 3 |
basad.py | qitianchan/new-busad | 0 | 12789297 | <filename>basad.py
# -*- coding: utf-8 -*-
from flask import Flask, blueprints, url_for
from extentions import db, login_manager
from views import auth_blueprint, busad_blueprint
from models import User
def create_app():
app = Flask(__name__)
# app config
app.config.from_object('config.DefaultConfig')
... | 2.359375 | 2 |
example_motion_sensor_gesture_data.py | coldppc/kpk | 0 | 12789298 | '''
This example will print the gesture name
'''
from communitysdk import list_connected_devices, MotionSensorKit
devices = list_connected_devices()
msk_filter = filter(lambda device: isinstance(device, MotionSensorKit), devices)
msk = next(msk_filter, None) # Get first Motion Sensor Kit
if msk == None:
print('No M... | 3.265625 | 3 |
container/src/models/note.py | PowercoderJr/oonote | 0 | 12789299 | <gh_stars>0
from app import db
class Note(db.Model):
id_ = db.Column(db.String(16), primary_key=True)
text = db.Column(db.Text)
response = db.Column(db.String(100))
created_at = db.Column(db.DateTime)
read_at = db.Column(db.DateTime)
password = db.Column(db.String(64))
| 2.078125 | 2 |
flasktodo/todos.py | blong191/flask-todo | 0 | 12789300 | <filename>flasktodo/todos.py<gh_stars>0
from flask import Blueprint, render_template, request
from . import db
bp = Blueprint("todos", __name__)
@bp.route("/", methods=("GET", "POST"))
def index():
"""View for home page which shows list of to-do items."""
conn = db.get_db()
cur = conn.cursor()
cur.... | 2.96875 | 3 |
src/collective/eeafaceted/z3ctable/tests/vocabularies.py | collective/collective.eeafaceted.z3ctable | 1 | 12789301 | # encoding: utf-8
from zope.interface import implements
from zope.schema.vocabulary import SimpleVocabulary
from zope.schema.interfaces import IVocabularyFactory
from zope.schema.vocabulary import SimpleTerm
from plone.memoize.instance import memoize
class TestingVocabulary(object):
implements(IVocabularyFactor... | 2.125 | 2 |
oops_fhir/r4/value_set/related_artifact_type.py | Mikuana/oops_fhir | 0 | 12789302 | <filename>oops_fhir/r4/value_set/related_artifact_type.py
from pathlib import Path
from fhir.resources.valueset import ValueSet as _ValueSet
from oops_fhir.utils import ValueSet
from oops_fhir.r4.code_system.related_artifact_type import (
RelatedArtifactType as RelatedArtifactType_,
)
__all__ = ["RelatedArtif... | 1.953125 | 2 |
Project/pix2pix_dense/loss.py | Kaustubh1Verma/CS671_Deep-Learning_2019 | 0 | 12789303 | <filename>Project/pix2pix_dense/loss.py
from tensorflow.python.keras.models import Sequential
from tensorflow.python.keras.layers.core import Flatten, Dense, Dropout
from tensorflow.python.keras.layers.convolutional import Convolution2D, MaxPooling2D, ZeroPadding2D
from tensorflow.python.keras.optimizers import SGD
imp... | 2.625 | 3 |
code-files/frosch2010_Tabu_settings.py | Frosch2010/discord-tabu | 2 | 12789304 | class tabu_settings:
tabu_channelID_join = None
tabu_channelID_team_1 = None
tabu_channelID_team_2 = None
tabu_channelID_add_terms = None
tabu_channelID_bot_admin = None
tabu_bot_token = None
tabu_server_ID = None
tabu_default_save_terms = True
tabu_save_after_game = T... | 1.359375 | 1 |
tester.py | jpypi/Multitron | 1 | 12789305 | #!/usr/bin/env python3
import numpy as np
import pickle
from PIL import Image
w = pickle.load(open("weights1000.pkl", "rb"))
def Classify(example):
return w.dot(example)
#Seems to get 2, 3, 4 correct...
for i in range(0, 5):
image = Image.open("test_images/{}.jpg".format(i)).convert("L")
x = np.asarray(i... | 3.046875 | 3 |
tests/test_equality.py | calebmarcus/awacs | 0 | 12789306 | import unittest
from awacs import s3, ec2, iam
from awacs.aws import PolicyDocument, Statement, Action, Condition
from awacs.aws import StringEquals, StringLike
class TestEquality(unittest.TestCase):
def test_condition_equality(self):
self.assertEqualWithHash(
Condition(StringLike("s3:prefix"... | 2.890625 | 3 |
tickets/migrations/0001_initial.py | mcm66103/ez-django | 1 | 12789307 | <reponame>mcm66103/ez-django<filename>tickets/migrations/0001_initial.py
# Generated by Django 2.2.13 on 2021-02-25 00:30
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
... | 1.617188 | 2 |
python-app/app/services/query.py | jnplonte/flask-api | 1 | 12789308 | <filename>python-app/app/services/query.py
def query(data):
finalQuery = {}
query = data.split('|')
if len(query) >= 1:
for qData in query:
if (qData.find(':') != -1):
qDataFinal = qData.split(':')
if (qDataFinal[1].find(',') != -1):
... | 2.859375 | 3 |
src/primaires/scripting/actions/changer_prix.py | vlegoff/tsunami | 14 | 12789309 | # -*-coding:Utf-8 -*
# Copyright (c) 2010-2017 <NAME>
# 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, this
# list of... | 1.53125 | 2 |
bot/urls.py | GautamPanickar/PanikarsBot | 1 | 12789310 | <reponame>GautamPanickar/PanikarsBot
from django.conf.urls import url
from . import views
urlpatterns = [
url(r'^$', views.index, name='index'),
url(r'^submit', views.submit, name='submit'),
]
# a dummy method for making db operations newboston video tutorial
#url(r'^(?P<message_id>[0-9]+)/$', views.... | 1.820313 | 2 |
swd/military_track.py | dfomin/7wd-engine | 0 | 12789311 | <reponame>dfomin/7wd-engine
from typing import Callable, Optional
import numpy as np
from .states.military_state_track import MilitaryTrackState
class MilitaryTrack:
@staticmethod
def apply_shields(state: MilitaryTrackState,
player_index: int,
shields: int,
... | 2.390625 | 2 |
release-assistant/javcra/application/modifypart/modifyentrance.py | openeuler-mirror/release-tools | 1 | 12789312 | #!/usr/bin/python3
# ******************************************************************************
# Copyright (c) Huawei Technologies Co., Ltd. 2020-2020. All rights reserved.
# licensed under the Mulan PSL v2.
# You can use this software according to the terms and conditions of the Mulan PSL v2.
# You may obtain a c... | 1.820313 | 2 |
tests/sim_tests.py | yy/clusim | 2 | 12789313 | # -*- coding: utf-8 -*-
#
# Tests for ``sim.py``
# These tests were hand calculated by <NAME>: <EMAIL>
#
from clusim.clustering import Clustering
import clusim.sim as sim
from clusim.dag import DAG
import clusim.clusimelement as clusimelement
from numpy.testing import assert_approx_equal
from numpy import mean
def ... | 2.390625 | 2 |
bindings/pydeck/examples/scripts/update_docs.py | wuweiweiwu/deck.gl | 0 | 12789314 | <gh_stars>0
import asyncio
import glob
import os
from pyppeteer import launch
here = os.path.dirname(os.path.abspath(__file__))
parent_directory = os.path.join(here, "..")
os.chdir(here)
example_glob = os.path.join(parent_directory, "*_layer.py")
async def run(cmd):
"""Runs a shell command within asyncio"""
... | 2.578125 | 3 |
tests/test_recursiveDecompression.py | zomry1/Hystrix-Box | 7 | 12789315 | from HystrixBox.Tools.recursiveDecompression import extract_recursive
import filecmp
import os
TEST1 = '''File not found\n'''
TEST2 = '''Not a zip file or corrupted zip file\n'''
def compareDir(dir1, dir2):
"""
Compare two directory trees content.
Return False if they differ, True is they are the... | 2.65625 | 3 |
doc/ext/genfortran.py | VACUMM/xoa | 7 | 12789316 | """Generate files to declare fortran functions"""
import os
import re
import logging
import importlib
from docutils.statemachine import string2lines
from sphinx.util.docutils import SphinxDirective
path_pat_mod_dir = os.path.join("{gendir}", "{mod_name}")
path_pat_mod_file = os.path.join(path_pat_mod_dir, "index.rs... | 2.421875 | 2 |
src/Methods/DataFromManyPersons/Univariate/__init__.py | syncpy/SyncPy | 20 | 12789317 | <gh_stars>10-100
"""
This package allows to compute synchronisation between monovariate signals gathered
from many persons.
"""
__all__ = ['Categorical', 'Continuous']
| 1.070313 | 1 |
mo_optimizers/min_norm_solvers.py | timodeist/multi_objective_learning | 0 | 12789318 | <reponame>timodeist/multi_objective_learning
"""
This code is taken from the repository accompanying the manuscript
Sener, Ozan, and <NAME>.
"Multi-task learning as multi-objective optimization."
arXiv preprint arXiv:1810.04650 (2018).
Neural Information Processing Systems (NeurIPS) 2018
https://github.com/intel-isl/Mu... | 1.25 | 1 |
tools/pack.py | sts-q/Einherjar | 20 | 12789319 | #!/usr/bin/env python
# Copyright (c) <NAME>.
# All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import sys
code = ' rtoeani' + 'smcylgfw' + 'dvpbhxuq' + '01234567' + \
'89j-k.z/' + ';:!+@*,?'
asm_encodings = [
'__',
'_r',
... | 1.78125 | 2 |
scripts/sha256_gcs_blobs.py | DataBiosphere/azul | 17 | 12789320 | <gh_stars>10-100
"""
Calculate the SHA-256 of Google Cloud Storage one or more blobs and write the
result as custom metadata to each blob.
"""
import argparse
import base64
import hashlib
import logging
import os
import sys
import tempfile
from typing import (
List,
Tuple,
)
from urllib import (
parse,
)
#... | 2.828125 | 3 |
CSIKit/tools/convert_json.py | FredeJ/CSIKit | 67 | 12789321 | <reponame>FredeJ/CSIKit
import json
from CSIKit.util.csitools import get_CSI
from CSIKit.reader import get_reader
def generate_json(path: str, metric: str="amplitude") -> str:
"""
This function converts a csi_trace into the json format. It works for single entry or the whole trace.
Parameters:
... | 2.78125 | 3 |
co2usa_load_netCDF.py | uataq/co2usa_data_synthesis | 0 | 12789322 | # -*- coding: utf-8 -*-
"""
co2usa_load_netCDF: Load the CO2-USA Data Synthesis files from netCDF
USAGE:
The CO2-USA synthesis data is available to download from the ORNL DAAC:
https://doi.org/10.3334/ORNLDAAC/1743
To download the data, first sign into your account (or create one if you don't have one).
Next, click... | 2.828125 | 3 |
PyObjCTest/test_nsbitmapimagerep.py | Khan/pyobjc-framework-Cocoa | 132 | 12789323 | <reponame>Khan/pyobjc-framework-Cocoa
from PyObjCTools.TestSupport import *
import objc
import array
import sys
from objc import YES, NO
from AppKit import *
try:
unicode
except NameError:
unicode = str
try:
long
except NameError:
long = int
class TestNSBitmapImageRep(TestCase):
def testInstant... | 2.109375 | 2 |
neutron/tests/api/test_bgp_speaker_extensions.py | wwriverrat/neutron | 1 | 12789324 | # Copyright 2016 Hewlett Packard Enterprise Development Company LP
#
# 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
#
# Unles... | 1.554688 | 2 |
supports/integration-test/dfsio_create_file.py | ypang2017/Test | 2 | 12789325 | <reponame>ypang2017/Test<gh_stars>1-10
import sys
from util import *
def create_file_DFSIO(num):
"""
Please use this script in namenode
Each time create 10K * 2 files (10K in io_data and 10K in io_control).
Then, move these data to TEST_DIR.
"""
dfsio_cmd = "hadoop jar /usr/lib/hadoop-mapreduc... | 2.46875 | 2 |
thirdweb/modules/bundle.py | princetonwong/python-sdk | 1 | 12789326 | """
Interact with the Bundle module of the app. Previously `collection`.
"""
from typing import List
from thirdweb_web3 import Web3
from ..abi.erc20 import ERC20
from ..abi.nft import SignatureMint721 as NFT
from ..abi.nft_collection import NFTCollection as NFTBundle
from ..types.bundle import BundleMetadata, CreateBu... | 2.34375 | 2 |
src/kep.py | Nyhilo/kep | 0 | 12789327 | # Module imports
from sys import argv as args
from datetime import datetime
# Local imports
# Parsing objects0
class file:
_date_format = "%Y-%m-%d %H:%M:%S"
def __init__(title,
date_created=None,
date_modified=None,
tags=[],
files=[]):
... | 3 | 3 |
pluginsmanager/model/system/system_effect_builder.py | SpotlightKid/PluginsManager | 9 | 12789328 | <reponame>SpotlightKid/PluginsManager<gh_stars>1-10
# Copyright 2017 SrMouraSilva
#
# 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... | 2.09375 | 2 |
omnipack/image/image_annotator.py | FrankLeeeee/powerpack | 0 | 12789329 | from PIL import Image, ImageDraw, ImageFont
class ImageAnnotator(object):
def __init__(self,
img_path: str,
font: str = None,
font_size: int = 5):
assert isinstance(img_path, str)
self._img = Image.open(img_path).convert('RGBA')
self._img... | 3.234375 | 3 |
library/tests/test_fx.py | pimoroni/plasma | 9 | 12789330 | import pytest
def test_fx_cycle(argv, GPIO):
"""Test that set_sequence supports the output of a PlasmaFX Sequence"""
from plasma import auto
from plasma.apa102 import PlasmaAPA102
from plasmafx import Sequence
from plasmafx.plugins import FXCycle
sequence = Sequence(10)
sequence.set_plugi... | 2.0625 | 2 |
meeting/serializers.py | ttppren-github/MeetingSample-Backend | 7 | 12789331 | from rest_framework import serializers
from meeting.models import Meeting
class BaseSerializer(serializers.Serializer):
def create(self, validated_data):
pass
def update(self, instance, validated_data):
pass
class NewMeetingIn(BaseSerializer):
name = serializers.CharField(max_length=12... | 2.140625 | 2 |
kachery/steady_download_and_compute_hash.py | flatironinstitute/kachery | 8 | 12789332 | import string
import random
import hashlib
import os
# import requests
import urllib
from typing import Union
import time
def steady_download_and_compute_hash(url: str, algorithm: str, target_path: str) -> str:
remote = urllib.request.urlopen(url)
str0 = ''.join(random.sample(string.ascii_lowercase, 8))
pa... | 2.640625 | 3 |
proto/def.bzl | mikedanese/rules_go | 1 | 12789333 | load("@io_bazel_rules_go//go/private:common.bzl",
"go_importpath",
)
load("@io_bazel_rules_go//go/private:mode.bzl",
"RACE_MODE",
"NORMAL_MODE",
)
load("@io_bazel_rules_go//go/private:providers.bzl",
"get_library",
"GoLibrary",
"GoEmbed",
)
load("@io_bazel_rules_go//go/private:rules/prefix.bzl",... | 1.6875 | 2 |
miyu_bot/commands/docs/documentation_fluent_localization.py | qwewqa/miyu-bot | 11 | 12789334 | from fluent.runtime import FluentLocalization
class DocumentationFluentLocalization(FluentLocalization):
def format_value(self, msg_id, args=None, fallback=None):
for bundle in self._bundles():
if not bundle.has_message(msg_id):
continue
msg = bundle.get_message(msg... | 2.390625 | 2 |
app.py | IndieDragoness/portfolio | 0 | 12789335 | <filename>app.py
from flask import Flask, render_template, request, send_file
from azure.cosmos import exceptions, CosmosClient, PartitionKey
from azure.core.exceptions import ResourceExistsError
from scripts import utilities
import logging
import json
import os
# ================================== #
# _____ ... | 2.078125 | 2 |
numpy_practice/a2_arrays.py | dkp-1024/my_machine_learning | 0 | 12789336 | <gh_stars>0
import numpy as np
#creating arrays
array = np.zeros(10, dtype='int')
# array([0, 0, 0, 0, 0, 0, 0, 0, 0, 0])
# print(array)
#creating a 3 row x 5 column matrix
array = np.ones((3,5), dtype=float)
# array([[ 1., 1., 1., 1., 1.],
# [ 1., 1., 1., 1., 1.],
# [ 1., 1., 1., 1., 1.]])
#... | 3.125 | 3 |
src/DeepMatter/VAE_PFM/__init__.py | m3-learning/DeepMatter | 2 | 12789337 | """
"""
from . import core
from . import file
from . import machine_learning
from . import dictionary_learning | 0.972656 | 1 |
random_forest_regression.py | manuelmusngi/machine_learning_algorithms_for_development | 1 | 12789338 | <gh_stars>1-10
# Random Forest Regression
# Import the libraries
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
# Import the dataset
dataset = pd.read_('')
X = dataset.iloc[:, 1:-1].values
y = dataset.iloc[:, -1].values
# Train the Random Forest Regression model on the dataset
from sklearn.en... | 3.46875 | 3 |
moosetools/__init__.py | NidorFanClub/oatcogs | 1 | 12789339 | from .moosetools import MooseTools
def setup(bot):
bot.add_cog(MooseTools())
| 1.46875 | 1 |
models/crnn.py | VanillaBrooks/Splitr | 1 | 12789340 | import sys
sys.path.insert(0, r'C:\Users\Brooks\github\splitr')# access library code from outside /models
# library functions:
import torch
import time
import pandas as pd
# Splitr modules:
import model_utils
# this is really a constructor for a bidirectional LSTM but i figured
# BD_LSTM was only 2 letters off of B... | 2.921875 | 3 |
test/vertex_cover_gen.py | s17k/VertexCover | 0 | 12789341 | <reponame>s17k/VertexCover<filename>test/vertex_cover_gen.py
import random
n = random.randint(1,3)
m = random.randint(1, n*(n-1)//2)
print str(n) + ' ' + str(m)
for i in range(m):
a = b = 1
while a == b:
a = random.randint(1,n)
b = random.randint(1,n)
print str(a) + ' ' + str(b)
print ran... | 3.09375 | 3 |
PyTorch/Resources/Examples/02_lstm_sentiment_analysis.py | methylDragon/python-data-tools-reference | 9 | 12789342 | # Modified from SUTD and https://github.com/bentrevett/pytorch-sentiment-analysis
# Sentiment Analysis on IMDB with FashionMNIST
# We're using packed sequences for training
# For more info: https://stackoverflow.com/questions/51030782/why-do-we-pack-the-sequences-in-pytorch
import torch.nn as nn
import torchtext
impo... | 3.1875 | 3 |
auton_survival/datasets_biolincc.py | mononitogoswami/auton-survival | 0 | 12789343 | <reponame>mononitogoswami/auton-survival
import pandas as pd
import numpy as np
def _encode_cols_index(df):
columns = df.columns
# Convert Objects to Strings
for col in columns:
if df[col].dtype == 'O':
df.loc[:, col] = df[col].values.astype(str)
# If Index is Object, covert to String
if df.i... | 2.921875 | 3 |
batching_benchmark.py | rdhara/modulo | 8 | 12789344 | <reponame>rdhara/modulo
import time
import random
import pandas
import seaborn as sns
import numpy as np
from matplotlib import pyplot as plt
class Module():
def __init__(self, proc_time=None):
self.proc_time = proc_time
def run(self):
time.sleep(self.proc_time)
class ModuleA(Module):
def ... | 2.234375 | 2 |
stacks/vmdkexport/resources/vmexport/vmdknotify/vmdknotify_function.py | aws-samples/ec2-imagebuilder-vmdk-export | 0 | 12789345 | ##################################################
## Notify VMDK export request
##################################################
import os
import boto3
from botocore.exceptions import ClientError
import json
import logging
def lambda_handler(event, context):
# set logging
logger = logging.getLogger()
l... | 1.898438 | 2 |
analysis_script/make_time_chart.py | nahimilega/subreddit-analyzer | 1 | 12789346 | <reponame>nahimilega/subreddit-analyzer<filename>analysis_script/make_time_chart.py
import datetime
import random
import matplotlib.pyplot as plt
import pymongo
from datetime import datetime
from collections import Counter
# Make chart of busy hours
# All charts in graph folder
def intilise_database():
"""
... | 3.140625 | 3 |
jakomics/kegg.py | jeffkimbrel/jakomics | 0 | 12789347 | <gh_stars>0
import uuid
import os
import subprocess
import re
import pandas as pd
from jakomics import colors
from jakomics.utilities import system_call
class KOFAM:
def __init__(self, line, t_scale=1.0):
parsed = re.split('\t', line)
self.parsed = parsed
self.gene = parsed[1]
s... | 2.3125 | 2 |
lensesio/data/policy.py | rsaggino/lenses-python | 13 | 12789348 | from lensesio.core.endpoints import getEndpoints
from lensesio.core.exec_action import exec_request
class Policy:
def __init__(self, verify_cert=True):
getEndpoints.__init__(self, "policyEndpoints")
self.verify_cert=verify_cert
self.lenses_policies_endpoint = self.url + self.lensesPolicie... | 2.140625 | 2 |
modelling/train_scripts/train_meta.py | TheisFerre/Thesis-paper | 0 | 12789349 | <reponame>TheisFerre/Thesis-paper
from modelling.models import BaselineGATLSTM, Edgeconvmodel, GATLSTM, Encoder, Decoder, STGNNModel, BaselineGNNLSTM
import torch
import torch.optim as optim
from torch.optim.lr_scheduler import ReduceLROnPlateau
import numpy as np
import dill
from data_processing.process_dataset import... | 2.34375 | 2 |
cirosantilli/utils.py | cirosantilli/python-utils | 1 | 12789350 | #!/usr/bin/env python
import re
import os.path
STDERR_SEPARATOR0 = '=' * 60
def iterify(iterable):
if isinstance(iterable, basestring):
iterable = [iterable]
try:
iter(iterable)
except TypeError:
iterable = [iterable]
return iterable
def resub(resubpair,target):
"""takes ... | 3 | 3 |