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 |
|---|---|---|---|---|---|---|
lib/preprocess.py | S-Hun/news-keyword-analysis | 1 | 12764751 | <gh_stars>1-10
import re
import json
import pandas as pd
from collections import Counter
from konlpy.tag import Okt
import os
import configparser
def getData(srcText, data_path):
fileName = srcText + "_naver_news"
return json.loads(open(data_path + '/' + fileName+'.json', 'r', encoding='utf-8').read())
def e... | 2.78125 | 3 |
Unet/utils.py | mcchran/segmentations | 3 | 12764752 | <filename>Unet/utils.py<gh_stars>1-10
#
# Utilities file
#
from keras.callbacks import EarlyStopping
from glob import glob
import os, numpy as np
from keras.preprocessing import image
from PIL import Image
from config import DEBUG_LEVEL
class meetExpectations(EarlyStopping):
'''
Applies an e... | 2.40625 | 2 |
Resources/Code/open-grok/opengrok-1.1-rc41/tools/src/main/python/mirror.py | briancabbott/xtrax | 2 | 12764753 | <reponame>briancabbott/xtrax
#!/usr/bin/env python3
#
# CDDL HEADER START
#
# The contents of this file are subject to the terms of the
# Common Development and Distribution License (the "License").
# You may not use this file except in compliance with the License.
#
# See LICENSE.txt included in this distribution for ... | 1.695313 | 2 |
interactions/tests/test_models.py | Ins-V/wc_crm | 0 | 12764754 | from django.test import TestCase
from django.urls import reverse
from interactions.models import Interaction
from interactions.tests.factories import InteractionFactory
class InteractionModelTestCase(TestCase):
"""Testing the interaction model class."""
def test_create_interaction(self):
interaction_... | 2.6875 | 3 |
bert-distillation/bert_distill/data/dataset.py | distillbert/code | 0 | 12764755 | from torchtext.data import Field, TabularDataset, Iterator
from torchtext.vocab import Vectors
import torch
from .base import allennlp_tokenize, basic_tokenize, uniform_unk_init, space_tokenize, \
bert_tokenize, gpt2_tokenize
_REGISTRY = {}
class RegisteredDataset(TabularDataset):
def __init_subclass__(cl... | 2.28125 | 2 |
pipeline/util/generate-makefile.py | goodb/go-site | 0 | 12764756 | <gh_stars>0
#!/usr/bin/env python3
"""
Generates a Makefile based on metadata descriptions of source files.
"""
__author__ = 'cjm'
import argparse
import yaml
from json import dumps
SKIP = ["goa_pdb", "goa_uniprot_gcrp"]
ONLY_GAF = ["goa_uniprot_all"]
def main():
parser = argparse.ArgumentParser(description='... | 2.453125 | 2 |
plat.py | hsoft/hscommon | 5 | 12764757 | <gh_stars>1-10
# Created On: 2011/09/22
# Copyright 2015 Hardcoded Software (http://www.hardcoded.net)
#
# This software is licensed under the "GPLv3" License as described in the "LICENSE" file,
# which should be included with this package. The terms are also available at
# http://www.gnu.org/licenses/gpl-3.0.html
... | 1.679688 | 2 |
ptf/scripts/helpers/target_helpers/python_term.py | sommercharles/fprime | 1 | 12764758 | <reponame>sommercharles/fprime
# This script will create two PTYs. One through a forkpty call
# that creates a copy of this script on a new PTY for control/shell
# PTY control. The second is in raw mode and just transfers bytes
# to the first one, allowing the TTY layer of the first to perform
# all the canonical trans... | 2.515625 | 3 |
tests/test_node.py | glennlaughlin/ariadne-relay | 0 | 12764759 | <reponame>glennlaughlin/ariadne-relay
from typing import Dict
from ariadne import InterfaceType, make_executable_schema, QueryType
from graphql import graphql_sync
from graphql_relay import to_global_id
from graphql_relay.utils import base64
from ariadne_relay import NodeInterfaceType, RelayObjectType, RelayQueryType... | 1.976563 | 2 |
indep_node_alarm.py | chandrodaya-net/indep_node_alarm | 0 | 12764760 | <reponame>chandrodaya-net/indep_node_alarm<filename>indep_node_alarm.py
import json
import time
import requests # sudo pip3 install requests
from pdpyras import APISession
import subprocess
import shutil
import config
import sys
from utils import create_logger
import traceback
# import socket
# print(socket.gethostnam... | 2.21875 | 2 |
wonk/policy.py | aminohealth/wonk | 103 | 12764761 | <filename>wonk/policy.py
"""Manage AWS policies."""
import json
import pathlib
import re
from typing import Dict, List, Tuple
from xdg import xdg_cache_home
from wonk import aws, exceptions, optimizer
from wonk.constants import MAX_MANAGED_POLICY_SIZE
from wonk.models import Policy, Statement, canonicalize_resources... | 2.5 | 2 |
src/main/1.launch_spiders.py | Peter-32/scrapy2 | 0 | 12764762 | <reponame>Peter-32/scrapy2
import os
import re
import scrapy
import shutil
import scrapy
from bs4 import BeautifulSoup
from scrapy.crawler import CrawlerProcess
try:
shutil.rmtree("html")
except:
pass
os.mkdir("html")
if not os.path.exists("../../data/processed"):
os.mkdir("../../data/processed")
# Custo... | 2.8125 | 3 |
generate_set.py | WilliamCSA04/sigver_wiwd | 0 | 12764763 | <reponame>WilliamCSA04/sigver_wiwd<filename>generate_set.py
import random
import os
from process_helper import filter_genuine, filter_forgery, filter_by_text, remove_invalid_files
def split_into_train_test(array, genuine_user, dataset_path, genuine_train_quantity, forgery_train_quantity, random_train_quantity):
pr... | 2.5625 | 3 |
Example/ExampleModel.py | djamal2727/Main-Bearing-Analytical-Model | 0 | 12764764 | # -*- coding: utf-8 -*-
"""
Created on Mon Sep 28 20:41:43 2020
@author: djamal
"""
import numpy as np
import matplotlib.pyplot as plt
import math
import pandas as pd
import sys
sys.path.append('C:/Users/DJAMAL/Documents/GitHub/Jamal_NREL2020')
#External Module
import MainBearing_Analytical_Model
import rwtparameters... | 2.28125 | 2 |
app/belinsky/routes/observability.py | riZZZhik/word_finder | 0 | 12764765 | """Belinsky observability blueprint."""
import os
from flask import Blueprint
from healthcheck import HealthCheck
from healthcheck.security import safe_dict
from prometheus_client import CollectorRegistry, generate_latest, multiprocess
from ..database import get_all
from ..models import User
# Create healthcheck fu... | 2.3125 | 2 |
mil_benchmark/utils.py | AntonValk/BagGraph-Graph-MIL | 8 | 12764766 | <filename>mil_benchmark/utils.py
import numpy as np
from numpy import matlib
from scipy.stats import t
import scipy.sparse as sp
from math import sqrt
from statistics import stdev
def normalize(mx):
"""Row-normalize sparse matrix"""
rowsum = np.array(mx.sum(1))
r_inv = np.power(rowsum, -1).flatten()
r... | 2.4375 | 2 |
main.py | thisischandanmishra/flight-information | 2 | 12764767 | <reponame>thisischandanmishra/flight-information
import os
from flask import Flask
from src.conf.config import SQLALCHEMY_DATABASE_URI
from src.conf.routes import generate_routes
from src.database.database import db
def create_app():
app = Flask(__name__)
app.config['DEBUG'] = True
app.config['SQLALCHEM... | 2.453125 | 2 |
pymoon/core/utils/extension_checker.py | hassanMuhamad/pymoon | 1 | 12764768 | <reponame>hassanMuhamad/pymoon
# !TODO:
# - Module that checks the file extension
# @entry: file Object || image Object
# return a flag
| 1.375 | 1 |
scripts/append_album_to_clementine.py | Mdlkxzmcp/various_python | 0 | 12764769 | <gh_stars>0
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Sun Jan 7 21:25:42 2018
@author: mdlkxzmcp
@version: 0.1.0
"""
import sys, getopt, os, re, dbus
def displayHelpMessage():
print("""
Usage: append_album_to_clementine.py [options]
Assumes: Clementine is running.
... | 2.640625 | 3 |
Dicts.py | SIEM-Tools/ArcSight | 4 | 12764770 | service_dict = {
'NetworkService':{
'getTargetsWithRelationshipTypeForResourceById':{},
'getTargetsByRelationshipForSourceId':{},
'getSourcesWithThisTargetByRelationshipCount':{},
'deleteResource':{},
'getSourceURIWithThisTargetByRelatiobnshipForResourceId':{},
'getAl... | 1.460938 | 1 |
tcam.py | luinaudt/python_lib | 0 | 12764771 | import sys
import math
import warnings
import logging
class tcam:
""" a basic tcam class
"""
def __init__(self,entryWidth, priWidth=8, addrWidth=int(math.log2(sys.maxsize)), valueWidth=32, size=sys.maxsize):
"""
entryWidth : width in bits of the entry
priWidth : Width of the pr... | 3.359375 | 3 |
month01/all_code/day17/exercise02.py | chaofan-zheng/tedu-python-demo | 4 | 12764772 | # 练习:使用学生列表封装以下三个列表中数据
class Student:
def __init__(self, name="", age=0, sex=""):
self.name = name
self.age = age
self.sex = sex
list_student_name = ["悟空", "八戒", "白骨精"]
list_student_age = [28, 25, 36]
list_student_sex = ["男", "男", "女"]
list_students = []
for item in zip(list_student_name,... | 4.34375 | 4 |
tests/test_feature_engineering.py | tvdboom/ATOM | 62 | 12764773 | # coding: utf-8
"""
Automated Tool for Optimized Modelling (ATOM)
Author: Mavs
Description: Unit tests for feature_engineering.py
"""
# Standard packages
import pandas as pd
import pytest
from sklearn.ensemble import ExtraTreesClassifier
from sklearn.feature_selection import f_regression
# Own modules
from atom.fea... | 2.6875 | 3 |
test/conftest.py | larsewi/cfbs | 0 | 12764774 | <gh_stars>0
import os
import pytest
@pytest.fixture(scope="function")
def chdir(request):
os.chdir(os.path.join(os.path.dirname(__file__), request.param))
yield
os.chdir(request.config.invocation_dir)
| 2.109375 | 2 |
gb_to_fasta/gb_to_fasta.py | willpatterson/ncbi_parser | 0 | 12764775 | from Bio import Entrez, SeqIO
import argparse
def gb_to_fasta(db_name, id_name, out_fasta):
Entrez.email = "<EMAIL>"
handle = Entrez.efetch(db=db_name, id=id_name, rettype="gb", retmode='text')
genome = SeqIO.read(handle, 'genbank')
#print(genome.features)
with open(out_fasta, "w") as ofasta:
... | 2.8125 | 3 |
BlochSolver/QuantumSolvers/numerics/numerical_methods.py | prz3m37/RandomBenchmarking | 0 | 12764776 | <reponame>prz3m37/RandomBenchmarking
import numpy as np
from BlochSolver.QuantumSolvers.rotations import rotation_handler as rh
class NumericalMethods:
n_shape = None
dt = None
h_bar = None
h_k = None
idn_num = None
j_max = None
j_min = None
@classmethod
def load_numerical_setti... | 2.109375 | 2 |
script/cal_overlap.py | zeta1999/SpinNet | 166 | 12764777 | <reponame>zeta1999/SpinNet
import os
from os.path import exists, join
import pickle
import numpy as np
import open3d
import cv2
import time
class ThreeDMatch(object):
"""
Given point cloud fragments and corresponding pose in '{root}'.
1. Save the aligned point cloud pts in '{savepath}/3DMatch_{downsam... | 2.359375 | 2 |
object_database/service_manager/Codebase.py | npang1/nativepython | 0 | 12764778 | # Copyright 2018 <NAME>
#
# 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 wr... | 1.84375 | 2 |
host/load.py | flowswitch/phison | 0 | 12764779 | <reponame>flowswitch/phison
"""load code"""
import sys
import PyScsi as drv
import Phison as ph
if len(sys.argv)!=2:
sys.exit("Load and start PRAM code file\nUsage: %s <file>" % (sys.argv[0]))
disk = ph.FindDrive()
if not disk:
sys.exit("No Phison devices found !")
drv.err_mode = drv.err_mode_raise
drv.open(disk)
... | 2.3125 | 2 |
insurance_claims/soa_app_data/soa_app_data.py | mlatcl/fbp-vs-oop | 6 | 12764780 | import requests
from insurance_claims.record_types import *
base_url = 'http://127.0.0.1:5000/'
class App():
def evaluate(self, save_dataset=False):
calculated_claims_value = self._calculate_claims_value()
classified_claims_value = self._classify_claims_value(calculated_claims_value)
cl... | 2.46875 | 2 |
manage.py | afh/yabab | 1 | 12764781 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
from flask.ext.script import Manager
from flask.ext.migrate import Migrate, MigrateCommand
from yabab import app, db
app.config.from_object('app_conf')
migrate = Migrate(app, db)
manager = Manager(app)
manager.add_command('db', MigrateCommand)
if __name__ ==... | 1.835938 | 2 |
pychron/pipeline/plot/panels/spectrum_panel.py | ael-noblegas/pychron | 0 | 12764782 | # ===============================================================================
# Copyright 2013 <NAME>
#
# 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/LI... | 1.640625 | 2 |
models/__init__.py | ybCliff/VideoCaptioning | 3 | 12764783 |
from .joint_representation import Joint_Representaion_Learner
from .seq2seq import Seq2Seq
from .rnn import Hierarchical_Encoder#Encoder_Baseline, LSTM_Decoder
from .bert import BertEncoder, BertDecoder, NVADecoder, DirectDecoder, APDecoder, SignalDecoder, Signal3Decoder, Signal2Decoder, NVDecoder, MSDecoder, ARDecode... | 2.03125 | 2 |
testsuite/tests/NA17-007__Ada_runtime_units/run_test.py | AdaCore/style_checker | 2 | 12764784 | <gh_stars>1-10
def test_a_cohama_adb(style_checker):
"""Style check test against a-cohama.adb."""
style_checker.set_year(2006)
p = style_checker.run_style_checker('trunk/gnat', 'a-cohama.adb')
style_checker.assertEqual(p.status, 0, p.image)
style_checker.assertRunOutputEmpty(p)
def test_a_cohamb_a... | 2.40625 | 2 |
examples/yolo/yolo/__main__.py | surround-deakin-team/surround | 0 | 12764785 | import logging
from .wrapper import PipelineWrapper
import os
import json
logging.basicConfig(level=logging.INFO)
def main():
wrapper = PipelineWrapper()
config = wrapper.get_config()
output = wrapper.run(json.dumps({"data": "hello"}))
with open(os.path.join(config["output_path"], "output.txt"), 'w') a... | 2.4375 | 2 |
deuce/tests/test_files_model.py | BenjamenMeyer/deuce | 0 | 12764786 | <reponame>BenjamenMeyer/deuce
from deuce.tests import V1Base
from deuce.model import File
class TestFilesModel(V1Base):
def setUp(self):
super(TestFilesModel, self).setUp()
# Create a vault and a file for us to work with
vault_name = 'files_vault_test'
fileid = 'My_Testing_File_I... | 2.25 | 2 |
Section 5/sha1.py | PacktPublishing/Hands-On-Cryptography-for-Python-Developers | 4 | 12764787 | <filename>Section 5/sha1.py
import hashlib
import struct
def hmac(message):
return hashlib.sha1("keykeykey1" + message).digest()
class SHA1LengthExtension:
digest_size = 20
block_size = 64
def __init__(self, digest, data, key_len):
# set constants
self.h0 = struct.unpack(b'>I', dig... | 3.21875 | 3 |
moviepy/audio/AudioClip.py | antiboredom/moviepy | 1 | 12764788 | import sys
from copy import copy
import numpy as np
from moviepy.audio.io.ffmpeg_audiowriter import ffmpeg_audiowrite
from moviepy.decorators import requires_duration
from moviepy.Clip import Clip
# optimize range in function of Python's version
if sys.version_info < (3,):
range = xrange
class AudioClip(Clip)... | 3.109375 | 3 |
src/wavestate/utilities/arguments/pyargparse.py | wavestate/wavestate-utilities | 0 | 12764789 | <gh_stars>0
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# SPDX-License-Identifier: Apache-2.0
# SPDX-FileCopyrightText: © 2021 Massachusetts Institute of Technology.
# SPDX-FileCopyrightText: © 2021 <NAME> <<EMAIL>>
# NOTICE: authors should document their contributions in concisely in NOTICE
# with details inline in ... | 2.15625 | 2 |
shell/myReadLine.py | utep-cs-systems-courses/os-shell-LailaMRomero | 0 | 12764790 | <reponame>utep-cs-systems-courses/os-shell-LailaMRomero<gh_stars>0
#! /usr/bin/env python3
#! /usr/bin/env python3
from os import read
ibuf = "" # Input buffer,
sbuf = "" # String buffer
sbufLength = 0 # String buffer length
currChar = 0 # Index of current char in sbuf
def getChar():
global ibuf... | 3.515625 | 4 |
swamp/search/tests/test_searchtarget.py | rigdenlab/SWAMP | 2 | 12764791 | import os
import swamp
import unittest
import joblib
from operator import itemgetter
from swamp.utils import remove, create_tempfile
from swamp.search.searchtarget import SearchTarget
TOPCONS_DUMY = """TOPCONS predicted topology:
iiiiiiiiiiiiiiMMMMMMMMMMMMMMMMMMMMMooooooMMMMMMMMMMMMMMMMMMMMMiiiiiiiiiiMMMMMMMMMMMMMMMMM... | 1.992188 | 2 |
python/models_intruderNet/model38.py | xilodyne/IntruderNet | 0 | 12764792 | <filename>python/models_intruderNet/model38.py
from keras.layers import Conv2D, MaxPooling2D, GlobalAveragePooling2D
from keras.layers import Dropout, Flatten, Dense
from keras.models import Sequential
from keras.utils import multi_gpu_model
class ModelIntruderNet38:
def __init__(self):
''' ... | 2.59375 | 3 |
linktitle/routes.py | zeinabmohammed/linktitle | 2 | 12764793 | import frappe
from frappe.utils import cstr, unique
@frappe.whitelist()
def title_field(doctype, name):
meta = frappe.get_meta(doctype)
if meta.title_field:
return frappe.db.get_value(doctype, name, meta.title_field or 'name')
else:
return name | 1.945313 | 2 |
perf/utils.py | jancajthaml-openbank/e2e | 0 | 12764794 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
import collections
import threading
import sys
import os
import stat
import shutil
import fcntl
import termios
import struct
import copy
import signal
import time
import fcntl
from functools import partial
this = sys.modules[__name__]
this.__progress_running = False
th... | 2.25 | 2 |
code/main.py | Samthebest999/AI-Friend | 0 | 12764795 | from functions import *
from imports import *
if os.path.exists("setup.py"):
os.remove("setup.py")
if os.path.exists("updater.py"):
os.remove("updater.py")
wget.download("https://raw.githubusercontent.com/Samthebest999/AI-Friend/main/code/updater.py")
def update():
current_toml = open("version.toml",... | 2.671875 | 3 |
gui/serializers.py | narsi84/digilib | 0 | 12764796 | from django.contrib.auth.models import User, Group
from rest_framework import serializers
from .models import *
class UserSerializer(serializers.HyperlinkedModelSerializer):
class Meta:
model = User
fields = ('url', 'username', 'email', 'groups')
class GroupSerializer(serializers.HyperlinkedMode... | 2.078125 | 2 |
gen-py/airr/ttypes.py | lasersonlab/airr-formats | 1 | 12764797 | <filename>gen-py/airr/ttypes.py
#
# Autogenerated by Thrift Compiler (0.9.3)
#
# DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
#
# options string: py:new_style
#
from thrift.Thrift import TType, TMessageType, TException, TApplicationException
from thrift.transport import TTransport
from thrift.pro... | 1.914063 | 2 |
lib/software_update.py | psidex/PyonAir-pycom | 0 | 12764798 | <filename>lib/software_update.py<gh_stars>0
from Configuration import config
from helper import wifi_lock, led_lock
import machine
import pycom
import time
from network import WLAN
from OTA import WiFiOTA
def software_update(logger):
"""
Connects to the wlan and fetches updates from a server. After having app... | 2.765625 | 3 |
papersite/spamdetector.py | josephabirached/papers | 22 | 12764799 | ### Stupid, but extensible spam detector
STOP_SPAM_WORDS = ["Loan", "Lender", ".trade", ".bid", ".men", ".win"]
def is_spam(request):
if 'email' in request.form:
if any(
[ word.upper() in request.form['email'].upper()
for word in STOP_SPAM_WORDS]):
return True
if 'username' in request.f... | 2.890625 | 3 |
examples/tensorflow-adversarial-patches/src/generate_patch.py | usnistgov/dioptra | 14 | 12764800 | #!/usr/bin/env python
# This Software (Dioptra) is being made available as a public service by the
# National Institute of Standards and Technology (NIST), an Agency of the United
# States Department of Commerce. This software was developed in part by employees of
# NIST and in part by NIST contractors. Copyright in po... | 1.6875 | 2 |
manage/config.py | augustand/kervice | 1 | 12764801 | <reponame>augustand/kervice<filename>manage/config.py
import logging
class Config(object):
def __init__(self):
self.__cfg = {
"log": {
"format": "PID %(process)d %(asctime)s %(levelname)-5s %(threadName)-10s [%(lineno)d]%(name)-15s %(message)s",
"datefmt": "%Y-%... | 2.453125 | 2 |
tests/test_inlinequeryresultlocation.py | ehsanbarkhordar/botcup | 1 | 12764802 | #!/usr/bin/env python
#
# A library that provides a Python interface to the Telegram Bot API
# Copyright (C) 2015-2018
# <NAME> <<EMAIL>>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser Public License as published by
# the Free Software Foundation, either ... | 2.28125 | 2 |
setup.py | SebastianSemper/chefkoch | 0 | 12764803 | # -*- coding: utf-8 -*-
# Copyright 2019 <NAME>
# https://www.tu-ilmenau.de/it-ems/
#
# 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
#
# ... | 1.726563 | 2 |
doctor/email_info.py | JuliasBright/SendMoney | 1 | 12764804 | <filename>doctor/email_info.py
EMAIL_HOST = 'smtp.gmail.com'
EMAIL_PORT = 587
EMAIL_HOST_USER = '<EMAIL>'
EMAIL_HOST_PASSWORD = '<PASSWORD>@'
EMAIL_USE_TLS = True | 1.3125 | 1 |
examples/srx/srx_nat_proxyarp.py | cro/py-junos-eznc | 0 | 12764805 | # for debugging ...
import pdb
from pprint import pprint as pp
from lxml import etree
# for the example ...
from jnpr.eznc import Netconf
from jnpr.eznc.resources.srx.nat import NatProxyArp
from jnpr.eznc.utils import Config
# create a junos device and open a connection
jdev = Netconf(user='jeremy', password='<PASS... | 2.453125 | 2 |
app.py | beyondchan28/API-Client---GoGoDot-Blog | 1 | 12764806 | <filename>app.py
from flask import Flask
from flask.templating import render_template
import requests
import json
app = Flask(__name__)
@app.route('/', methods=['GET'])
def index():
url = "http://localhost:8000/resource/"
headers = {
'Content-Type': "application/json",
'Authorization': "<KEY>"... | 2.875 | 3 |
Practicals03/Example01.py | MichalKyjovsky/NPRG065_Programing_in_Python | 0 | 12764807 | #! /usr/bin/env Python3
list_of_tuples = []
list_of_tuples_comprehension = ([(i, j, i * j) for i in range(1, 11) for j in range(1, 11)])
for i in range(1, 11):
for j in range(1, 11):
list_of_tuples.append((i, j, i * j))
print(list_of_tuples)
print('************')
print(list_of_tuples_comprehension)
| 4.03125 | 4 |
ppmessage/db/sqlpgsql.py | gamert/ppmessage | 6 | 12764808 | # -*- coding: utf-8 -*-
#
# Copyright (C) 2010-2016 PPMessage.
# <NAME>, <EMAIL>.
# All rights reserved
#
# db/sqlpsql.py
#
from .sqlnone import SqlNone
from ppmessage.core.constant import SQL
from ppmessage.core.singleton import singleton
from sqlalchemy.orm import sessionmaker
from sqlalchemy.orm import scoped_sess... | 2.46875 | 2 |
data-cleaning/parse_xml2dom.py | RoderickLi/python-snippet | 6 | 12764809 | # see ()[https://stackoverflow.com/a/40749716]
from xml.dom.minidom import parseString
html_string = """
<!DOCTYPE html>
<html><head><title>title</title></head><body><p>test</p></body></html>
"""
# extract the text value of the document's <p> tag:
doc = parseString(html_string)
paragraph = doc.getElementsByTagName("... | 3.140625 | 3 |
mgba_gamedata/gb/__init__.py | mgba-emu/gamedata | 2 | 12764810 | from mgba_gamedata.registry import Platform, Game
class GB(Platform):
pass
class GBGame(Game):
platform = GB
| 1.585938 | 2 |
Leak #5 - Lost In Translation/windows/Resources/Ops/PyScripts/lib/ops/data/logonasuser.py | bidhata/EquationGroupLeaks | 9 | 12764811 | <reponame>bidhata/EquationGroupLeaks<gh_stars>1-10
from ops.data import OpsClass, OpsField, DszObject, DszCommandObject, cmd_definitions
import dsz
if ('logonasuser' not in cmd_definitions):
dszlogonasuser = OpsClass('logon', {'handle': OpsField('handle', dsz.TYPE_INT), 'alias': OpsField('alias', dsz.TYPE_STRING)}... | 2.09375 | 2 |
eden/integration/hg/sparse_test.py | jmswen/eden | 0 | 12764812 | <reponame>jmswen/eden
#!/usr/bin/env python3
#
# Copyright (c) 2016-present, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree. An additional grant
# of patent rights can be found in the PATENTS file i... | 1.648438 | 2 |
app/recipe/tests/test_recipe_api.py | xWaterBottlex/recipe-app-api | 0 | 12764813 | <filename>app/recipe/tests/test_recipe_api.py<gh_stars>0
from django.contrib.auth import get_user_model
from django.urls import reverse
from rest_framework.test import APITestCase
from rest_framework import status
from core.models import Recipe, Tag, Ingredient
from recipe.serializers import RecipeSerializer, Recipe... | 2.5 | 2 |
formulas/confluent_hypergeometric.py | pascalmolin/fungrim | 0 | 12764814 | from .expr import *
def_Topic(
Title("Confluent hypergeometric functions"),
Entries(
"316533",
"f565f5",
"512bea",
"cee331",
"d6add6",
"1b9cc5",
"b9cc75",
),
Section("Hypergeometric series"),
Entries(
"4c41ad",
"0a0aec",
... | 1.945313 | 2 |
music/class_/audioa/d/base/_key.py | jedhsu/music | 0 | 12764815 | """
*D Key*
A key of D.
"""
from abc import ABCMeta
__all__ = ["D_Key"]
class D_Key:
__metaclass__ = ABCMeta
| 2.375 | 2 |
validation_strategy.py | jodsche/recsys2018-1 | 0 | 12764816 | import joblib
import numpy as np
import pandas as pd
np.random.seed(0)
df_tracks = pd.read_hdf('df_data/df_tracks.hdf')
df_playlists = pd.read_hdf('df_data/df_playlists.hdf')
df_playlists_info = pd.read_hdf('df_data/df_playlists_info.hdf')
df_playlists_test = pd.read_hdf('df_data/df_playlists_test.hdf')
df_playlists_... | 2.4375 | 2 |
returns/interfaces/specific/reader.py | thecoblack/returns | 0 | 12764817 | """
This module is special.
``Reader`` does not produce ``ReaderBasedN`` interface as other containers.
Because ``Reader`` can be used with two or three type arguments:
- ``RequiresContext[value, env]``
- ``RequiresContextResult[value, error, env]``
Because the second type argument changes its meaning
based on the u... | 2.25 | 2 |
confu/builds/__init__.py | ararslan/confu | 13 | 12764818 | from confu.builds.base import Build
from confu.builds.unix import UnixBuild
from confu.builds.pnacl import PNaClBuild
from confu.builds.emscripten import EmscriptenBuild
from confu.builds.module import Module, ModuleCollection
from confu.builds.deps import DependencyCollection
| 0.960938 | 1 |
tgpy/api.py | tm-a-t/TGPy | 14 | 12764819 | <filename>tgpy/api.py
import logging
from typing import Any, Callable
class API:
code_transformers: list[tuple[str, Callable[[str], str]]]
variables: dict[str, Any]
constants: dict[str, Any]
def __init__(self):
self.variables = {}
self.constants = {}
self.code_transformers = [... | 2.546875 | 3 |
paper_pictures_AirPollutionData.py | KirstieJane/bocpdms | 21 | 12764820 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Thu Feb 8 17:03:07 2018
@author: jeremiasknoblauch
Description: Plots pics from Air Pollution Data London
"""
import csv
import numpy as np
from Evaluation_tool import EvaluationTool
from matplotlib import pyplot as plt
import matplotlib.dates as mdates
... | 2.546875 | 3 |
sakt/__init__.py | scaomath/kaggle-riiid-test | 0 | 12764821 | <gh_stars>0
from .sakt import *
# from .train_sakt_final import * | 1.078125 | 1 |
Vargi_Bots/ros_packages/pkg_task5/scripts/node_t5_ur5_1_package_pick.py | ROBODITYA/Eyantra-2021-Vargi-Bots | 1 | 12764822 | #!/usr/bin/env python
''' This node is used for controlling the ur5_1 arm and conveyor belt. '''
import sys
import math
import datetime
from datetime import datetime
import yaml
import rospy
import rospkg
import moveit_commander
import moveit_msgs.msg
import actionlib
from std_srvs.srv import Empty
from std_msgs.m... | 2.296875 | 2 |
tests/utils.py | MattSegal/cjob | 1 | 12764823 | <filename>tests/utils.py
import os
import boto3
def settings_factory(**kwargs):
def get_settings():
return {
"AWS_REGION": "ap-southeast-2",
"AWS_PROFILE": "default",
"EC2_INSTANCE_TYPE": "r5.2xlarge",
"EC2_KEY_FILE_PATH": "~/.ssh/testkey.pem",
*... | 2.09375 | 2 |
bioplus/wrappers.py | benjschiller/seriesoftubes | 1 | 12764824 | <reponame>benjschiller/seriesoftubes
# this module wraps the built-in module random
# and provides some useful random sequence generators, etc.
import random
import itertools
def random_seq(n=1,GC=0.5):
'''random_seq provides a random nucleotide (A, T, G, or C). You may optionally provide n, a positive integer, whic... | 3.390625 | 3 |
src/modules/trainer.py | tkosht/forecaster | 0 | 12764825 | <filename>src/modules/trainer.py
import datetime
import numpy
import torch
import torch.optim as optim
import mlflow
import pickle
from torch.utils.tensorboard import SummaryWriter
from typing import Tuple
from .util.items import Items
from .dataset.batcher import BatchMaker
from .dataset.dateset import Tsr
class T... | 2.34375 | 2 |
shor/operations.py | jywyq/shor | 0 | 12764826 | from shor.layers import _BaseLayer
class _Operation(_BaseLayer):
"""Abstract base quantum computing operation class
"""
def __init__(self, **kwargs):
super().__init__(**kwargs)
def to_gates(self):
return []
class Measure(_Operation):
def __init__(self, *bits, axis='z', **kwargs... | 2.53125 | 3 |
prototype/3DO_FFI_bindings/external_direct_optimization/test-suite/python_3/variance.py | recursion-ninja/PCG | 0 | 12764827 | #! usr/bin/env python
from math import sqrt
for run in range(6):
file1 = open("../data/times_just_C_run_{}.txt".format(run))
file2 = open("../data/times_poy_processor_{}.txt".format(run))
C_times_str = file1.readlines()
POY_times_str = file2.readlines()
if len(C_times_str) < 11 or len(POY_time... | 3.25 | 3 |
pytorch_lit/shared_params.py | lipovsek/PyTorch-LIT | 151 | 12764828 | <filename>pytorch_lit/shared_params.py
from torch.nn import Parameter
from .memory import Memory
class SharedParameterUtil:
_isHijacked = False
_memory = None
_mainNew = None
@staticmethod
def _shared_new(cls, data=None, requires_grad=True):
if data is None:
return SharedPara... | 2.453125 | 2 |
ferenda/sources/legal/se/kommitte.py | redhog/ferenda | 18 | 12764829 | # -*- coding: utf-8 -*-
from __future__ import (absolute_import, division,
print_function, unicode_literals)
from builtins import *
import re
from . import SwedishLegalStore, Trips
class KommitteStore(SwedishLegalStore):
def basefile_to_pathfrag(self, basefile):
# "Ju 2012:01" ... | 2.546875 | 3 |
tests/test_input.py | skurmedel/wordsalad | 0 | 12764830 | from wordsalad.input import split_germanic, group_words
import unittest
class TestTokenisation(unittest.TestCase):
def test_split_germanic_punctuation_treated_like_one_word(self):
txt = "abc. def.,"
res = list(split_germanic(txt))
self.assertListEqual(["abc", ".", "def", ".", ","], r... | 3.796875 | 4 |
Validation/Tools/scripts/simpleEdmComparison.py | trackerpro/cmssw | 1 | 12764831 | <reponame>trackerpro/cmssw
#! /usr/bin/env python
from __future__ import print_function
import inspect
import itertools
import logging
import optparse
import pprint
import random
import sys
import ROOT
from DataFormats.FWLite import Events, Handle
typeMap = { 'double' : ['double', 'vector<double>'],
'int... | 2.296875 | 2 |
src/models/__init__.py | NoSyu/CDMM-B | 1 | 12764832 | <gh_stars>1-10
from .cdmmb import *
| 1.078125 | 1 |
wedding/views.py | markbackhouse/django-wedding-website | 0 | 12764833 | <reponame>markbackhouse/django-wedding-website
from django.conf import settings
from django.shortcuts import render
from guests.save_the_date import SAVE_THE_DATE_CONTEXT_MAP
def home(request):
return render(
request,
"home.html",
context={
"save_the_dates": SAVE_THE_DATE_CONT... | 1.84375 | 2 |
vmrunner/vmrunner.py | Mattlk13/include-OS | 0 | 12764834 | <reponame>Mattlk13/include-OS
import os
import sys
import subprocess
import thread
import threading
import time
import re
import linecache
import traceback
import validate_vm
import signal
import psutil
from prettify import color
INCLUDEOS_HOME = None
nametag = "<VMRunner>"
if "INCLUDEOS_PREFIX" not in os.environ:
... | 2.078125 | 2 |
hypothesis/summary/train.py | JoeriHermans/hypothesis | 45 | 12764835 | r"""Summary objects at the end of training procedures."""
import numpy as np
import pickle
import torch
class TrainingSummary:
def __init__(self,
model_best,
model_final,
epochs,
epoch_best,
losses_train,
losses_test=None,
identifier=None):
self.i... | 2.6875 | 3 |
python/helpers/tests/generator3_tests/data/SkeletonGeneration/segmentation_fault_handling/sigsegv.py | tgodzik/intellij-community | 2 | 12764836 | <filename>python/helpers/tests/generator3_tests/data/SkeletonGeneration/segmentation_fault_handling/sigsegv.py
import ctypes
ctypes.string_at(0)
| 1.03125 | 1 |
2020/07/day7.py | jscpeterson/advent-of-code-2020 | 0 | 12764837 | TARGET_BAG = 'shiny gold'
def get_data(filepath):
return [line.strip() for line in open(filepath).readlines()]
def parse_rule(rule):
rule = rule.split(' ')
adj, color = rule[0], rule[1]
container_bag = '%s %s' % (adj, color)
bags_contained = {}
if rule[4:] == ['no', 'other', 'bags.']:
... | 3.3125 | 3 |
mbed_flasher/flashers/__init__.py | bridadan/mbed-flasher | 0 | 12764838 | <filename>mbed_flasher/flashers/__init__.py
#!/usr/bin/env python
"""
Copyright 2016 ARM Limited
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
Unle... | 1.65625 | 2 |
pages/mixins.py | rangertaha/django-boilerplate-pages | 0 | 12764839 | <gh_stars>0
#-*- coding:utf-8 -*-
"""
"""
import logging
import random
from django.contrib.messages.views import SuccessMessageMixin
from django.views.generic.list import ListView
from django.views.generic.edit import FormView
from django.views.generic.base import ContextMixin
from django.views.generic import View
fro... | 1.992188 | 2 |
djangoq_demo/order_reminder/models.py | forance/django-q | 0 | 12764840 | from decimal import Decimal
from django.db import models
# Create your models here.
class Orders(models.Model):
order_id = models.CharField( max_length=200, blank=False, null=True, unique=True)
ship_date = models.DateField(auto_now_add=False, auto_now=False, null=True)
customer = models.CharField("Company Name",m... | 2.359375 | 2 |
tests/utils.py | tdm-project/pykeyrock | 0 | 12764841 | #!/usr/bin/env python
#
# Copyright 2021 CRS4 - Center for Advanced Studies, Research and Development
# in Sardinia
#
# 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.ap... | 1.992188 | 2 |
news/admin.py | SIBSIND/PHPMYADMINWEBSITE | 31 | 12764842 | # -*- coding: UTF-8 -*-
# vim: set expandtab sw=4 ts=4 sts=4:
#
# phpMyAdmin web site
#
# Copyright (C) 2008 - 2016 <NAME> <<EMAIL>>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either vers... | 2.265625 | 2 |
donut/modules/editor/__init__.py | rlin0/donut | 0 | 12764843 | <reponame>rlin0/donut
import flask
blueprint = flask.Blueprint(
'editor',
__name__,
template_folder='templates',
static_folder='static',
static_url_path='/donut/modules/editor/static')
import donut.modules.editor.routes
| 1.921875 | 2 |
hy-data-analysis-with-python-spring-2020/part03-e06_meeting_lines/test/test_meeting_lines.py | Melimet/DAP2020 | 0 | 12764844 | <filename>hy-data-analysis-with-python-spring-2020/part03-e06_meeting_lines/test/test_meeting_lines.py
#!/usr/bin/python3
import unittest
from unittest.mock import patch
import numpy as np
from tmc import points
from tmc.utils import load, get_out, patch_helper
module_name='src.meeting_lines'
meeting_lines = load(m... | 2.421875 | 2 |
example/__init__.py | aeroworks-io/python-ddd | 1 | 12764845 | <filename>example/__init__.py
from faker import Faker
from dddpy import Entity, ID, Primitive
fake = Faker()
fake.seed_instance(0)
class UserID(ID):
...
class UserName(Primitive, str):
"""User's name"""
@classmethod
def __generate__(cls):
return cls(fake.name())
class User(Entity):
... | 2.875 | 3 |
muDIC/utils/utilities.py | diehlpk/muDIC | 7 | 12764846 | from functools import reduce
import scipy.ndimage as nd
import numpy as np
def convert_to_img_frame(img, node_position, mesh, borders, settings):
local_node_pos = np.zeros((2, mesh.element_def.n_nodes), dtype=settings.precision)
# Partition image
image_frame = extract_subframe(img, borders, settings.pad)... | 2.515625 | 3 |
src/voice_command/voice_recognition.py | Team-1-TTM4115/OfficePortal | 0 | 12764847 | import speech_recognition as sr
import re
TEXT_TO_NUMBER = {
'0': 0,
'zero': 0,
'1': 1,
'one': 1,
'2': 2,
'two': 2,
'to': 2,
'too': 2,
'3': 3,
'three': 3,
'tree': 3,
'4': 4,
'four': 4,
'for': 4,
'5': 5,
'five': 5,
}
def text_to_number(text, keyword):
... | 3.34375 | 3 |
call_api.py | jimwangzx/PhishBuster | 1 | 12764848 | from urllib.parse import urlparse
import requests
import re
def url_syntax(url_changes):
url_search_http = re.search("http", url_changes)
if url_search_http is None:
url_http = "http://" + url_changes
else:
url_http = url_changes
return url_http # Returns the url with 'http://... | 3.515625 | 4 |
backend/projects/tests/test_models.py | LucasSantosGuedes/App-Gestao | 142 | 12764849 | import pytest
from mixer.backend.django import mixer
from projects.models import Project, ProjectMembership
from users.models import User
@pytest.mark.django_db
class TestProject:
def test_project_create(self):
user = mixer.blend(User, username='test')
proj = mixer.blend(Project, owner = user)
... | 2.328125 | 2 |
armstrong/core/arm_content/tests/video/backends/youtube.py | cirlabs/armstrong.core.arm_content | 0 | 12764850 | from ..._utils import *
from ....fields.video import EmbeddedVideo
from ....video.backends import helpers
from ....video.backends.youtube import YouTubeBackend
class YouTubeBackendTestCase(ArmContentTestCase):
def generate_random_url(self):
random_id = str(random.randint(100, 200))
url = "http://... | 2.578125 | 3 |