max_stars_repo_path stringlengths 4 286 | max_stars_repo_name stringlengths 5 119 | max_stars_count int64 0 191k | id stringlengths 1 7 | content stringlengths 6 1.03M | content_cleaned stringlengths 6 1.03M | language stringclasses 111
values | language_score float64 0.03 1 | comments stringlengths 0 556k | edu_score float64 0.32 5.03 | edu_int_score int64 0 5 |
|---|---|---|---|---|---|---|---|---|---|---|
tests/__init__.py | bio2bel/famplex | 0 | 11800 | <reponame>bio2bel/famplex<filename>tests/__init__.py
# -*- coding: utf-8 -*-
"""Tests for Bio2BEL FamPlex."""
| # -*- coding: utf-8 -*-
"""Tests for Bio2BEL FamPlex.""" | en | 0.57745 | # -*- coding: utf-8 -*- Tests for Bio2BEL FamPlex. | 0.859073 | 1 |
dfainductor/algorithms/searchers.py | ctlab/DFA-Inductor-py | 2 | 11801 | <gh_stars>1-10
from typing import List
from pysat.solvers import Solver
from ..variables import VarPool
from .reductions import ClauseGenerator
from ..examples import BaseExamplesProvider
from ..logging_utils import *
from ..statistics import STATISTICS
from ..structures import APTA, DFA, InconsistencyGraph
class L... | from typing import List
from pysat.solvers import Solver
from ..variables import VarPool
from .reductions import ClauseGenerator
from ..examples import BaseExamplesProvider
from ..logging_utils import *
from ..statistics import STATISTICS
from ..structures import APTA, DFA, InconsistencyGraph
class LSUS:
_solve... | none | 1 | 2.136548 | 2 | |
lc_sqlalchemy_dbutils/manager.py | libcommon/sqlalchemy-dbutils-py | 0 | 11802 | <reponame>libcommon/sqlalchemy-dbutils-py
## -*- coding: UTF8 -*-
## manager.py
## Copyright (c) 2020 libcommon
##
## 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, inc... | ## -*- coding: UTF8 -*-
## manager.py
## Copyright (c) 2020 libcommon
##
## 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... | en | 0.75385 | ## -*- coding: UTF8 -*- ## manager.py ## Copyright (c) 2020 libcommon ## ## 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... | 1.712552 | 2 |
mazeexperiment/__main__.py | NickAnderegg/rpacr-mazeexperiment | 0 | 11803 | <gh_stars>0
# -*- coding: utf-8 -*-
"""mazeexperiment.__main__: executed when mazeexperiment directory is called as script."""
from .mazeexperiment import main
main()
| # -*- coding: utf-8 -*-
"""mazeexperiment.__main__: executed when mazeexperiment directory is called as script."""
from .mazeexperiment import main
main() | en | 0.92984 | # -*- coding: utf-8 -*- mazeexperiment.__main__: executed when mazeexperiment directory is called as script. | 1.204921 | 1 |
kafka_demo_1/producer.py | Aguinore/udemy_kafka_demo | 0 | 11804 | from tweepy import StreamListener, OAuthHandler, Stream
from configs import Configs
import sys
class StdOutListener(StreamListener):
def __init__(self, kafka_producer, topic):
super().__init__()
self.kafka_producer = kafka_producer
self.topic = topic
""" A listener handles tweets tha... | from tweepy import StreamListener, OAuthHandler, Stream
from configs import Configs
import sys
class StdOutListener(StreamListener):
def __init__(self, kafka_producer, topic):
super().__init__()
self.kafka_producer = kafka_producer
self.topic = topic
""" A listener handles tweets tha... | en | 0.759415 | A listener handles tweets that are received from the stream. # https://www.confluent.io/blog/introduction-to-apache-kafka-for-python-programmers/ | 2.617371 | 3 |
demo/examples/stability/advection_d2q4.py | bgraille/pylbm | 106 | 11805 |
"""
Stability analysis of the
D2Q4 solver for the advection equation
d_t(u) + c_x d_x(u) + c_y d_y(u) = 0
"""
import sympy as sp
import pylbm
# pylint: disable=invalid-name
# symbolic variables
U, X, Y = sp.symbols('U, X, Y')
# symbolic parameters
LA, CX, CY = sp.symbols('lambda, cx, cy', constants=True)
S_... |
"""
Stability analysis of the
D2Q4 solver for the advection equation
d_t(u) + c_x d_x(u) + c_y d_y(u) = 0
"""
import sympy as sp
import pylbm
# pylint: disable=invalid-name
# symbolic variables
U, X, Y = sp.symbols('U, X, Y')
# symbolic parameters
LA, CX, CY = sp.symbols('lambda, cx, cy', constants=True)
S_... | en | 0.446839 | Stability analysis of the D2Q4 solver for the advection equation d_t(u) + c_x d_x(u) + c_y d_y(u) = 0 # pylint: disable=invalid-name # symbolic variables # symbolic parameters # numerical parameters # velocity of the scheme # relaxation parameters # velocity of the advection equation | 2.40922 | 2 |
glimix_core/_util/_array.py | Horta/limix-inference | 7 | 11806 | from numpy import reshape
def vec(x):
return reshape(x, (-1,) + x.shape[2:], order="F")
def unvec(x, shape):
return reshape(x, shape, order="F")
| from numpy import reshape
def vec(x):
return reshape(x, (-1,) + x.shape[2:], order="F")
def unvec(x, shape):
return reshape(x, shape, order="F")
| none | 1 | 3.414665 | 3 | |
src/tests/component/test_engine_manager.py | carbonblack/cbc-binary-toolkit | 8 | 11807 | # -*- coding: utf-8 -*-
# *******************************************************
# Copyright (c) VMware, Inc. 2020-2021. All Rights Reserved.
# SPDX-License-Identifier: MIT
# *******************************************************
# *
# * DISCLAIMER. THIS PROGRAM IS PROVIDED TO YOU "AS IS" WITHOUT
# * WARRANTIES OR C... | # -*- coding: utf-8 -*-
# *******************************************************
# Copyright (c) VMware, Inc. 2020-2021. All Rights Reserved.
# SPDX-License-Identifier: MIT
# *******************************************************
# *
# * DISCLAIMER. THIS PROGRAM IS PROVIDED TO YOU "AS IS" WITHOUT
# * WARRANTIES OR C... | en | 0.558481 | # -*- coding: utf-8 -*- # ******************************************************* # Copyright (c) VMware, Inc. 2020-2021. All Rights Reserved. # SPDX-License-Identifier: MIT # ******************************************************* # * # * DISCLAIMER. THIS PROGRAM IS PROVIDED TO YOU "AS IS" WITHOUT # * WARRANTIES OR CO... | 1.932944 | 2 |
funolympics/apps.py | codeema/Yokiyo | 0 | 11808 | <filename>funolympics/apps.py
from django.apps import AppConfig
class FunolympicsConfig(AppConfig):
name = 'funolympics'
| <filename>funolympics/apps.py
from django.apps import AppConfig
class FunolympicsConfig(AppConfig):
name = 'funolympics'
| none | 1 | 1.209335 | 1 | |
src/gt4sd/algorithms/generation/polymer_blocks/core.py | hhhsu0825/gt4sd-core | 0 | 11809 | <filename>src/gt4sd/algorithms/generation/polymer_blocks/core.py
"""PaccMann vanilla generator trained on polymer building blocks (catalysts/monomers)."""
import logging
import os
from dataclasses import field
from typing import ClassVar, Dict, Optional, TypeVar
from ....domains.materials import SmallMolecule, valida... | <filename>src/gt4sd/algorithms/generation/polymer_blocks/core.py
"""PaccMann vanilla generator trained on polymer building blocks (catalysts/monomers)."""
import logging
import os
from dataclasses import field
from typing import ClassVar, Dict, Optional, TypeVar
from ....domains.materials import SmallMolecule, valida... | en | 0.709679 | PaccMann vanilla generator trained on polymer building blocks (catalysts/monomers). Polymer blocks generation. Args: configuration: domain and application specification, defining types and validations. target: unused since it is not a conditional generator. Exam... | 2.356551 | 2 |
src/form/panel/MultiPanel.py | kaorin/vmd_sizing | 32 | 11810 | <gh_stars>10-100
# -*- coding: utf-8 -*-
#
import wx
import wx.lib.newevent
from form.panel.BasePanel import BasePanel
from form.parts.SizingFileSet import SizingFileSet
from module.MMath import MRect, MVector3D, MVector4D, MQuaternion, MMatrix4x4 # noqa
from utils import MFileUtils # noqa
from utils.MLogger import ML... | # -*- coding: utf-8 -*-
#
import wx
import wx.lib.newevent
from form.panel.BasePanel import BasePanel
from form.parts.SizingFileSet import SizingFileSet
from module.MMath import MRect, MVector3D, MVector4D, MQuaternion, MMatrix4x4 # noqa
from utils import MFileUtils # noqa
from utils.MLogger import MLogger # noqa
log... | ja | 0.98957 | # -*- coding: utf-8 -*- # # noqa # noqa # noqa # ファイルセットクリアボタン # ファイルセットクリアボタン # ファイルセット # ファイルセット用基本Sizer # self.scrolled_window.SetBackgroundColour(wx.SystemSettings.GetColour(wx.SYS_COLOUR_3DLIGHT)) # self.scrolled_window.SetBackgroundColour("BLUE") # スクロールバーの表示のためにサイズ調整 # self.sizer.FitInside(self.scrolled_window) ... | 2.127686 | 2 |
androgui.py | nawfling/androguard | 1 | 11811 | <gh_stars>1-10
#!/usr/bin/env python
"""Androguard Gui"""
import argparse
import os
import sys
from androguard.core import androconf
from androguard.gui.mainwindow import MainWindow
from PyQt5 import QtWidgets, QtGui
if __name__ == '__main__':
parser = argparse.ArgumentParser(description="Androguard GUI")
p... | #!/usr/bin/env python
"""Androguard Gui"""
import argparse
import os
import sys
from androguard.core import androconf
from androguard.gui.mainwindow import MainWindow
from PyQt5 import QtWidgets, QtGui
if __name__ == '__main__':
parser = argparse.ArgumentParser(description="Androguard GUI")
parser.add_argum... | en | 0.61794 | #!/usr/bin/env python Androguard Gui # We need that to save huge sessions when leaving and avoid # RuntimeError: maximum recursion depth exceeded while pickling an object # or # RuntimeError: maximum recursion depth exceeded in cmp # http://stackoverflow.com/questions/2134706/hitting-maximum-recursion-depth-using-pytho... | 2.067342 | 2 |
python-trunk/sfapi2/sflib/ZSI/wstools/XMLname.py | raychorn/svn_molten-magma | 0 | 11812 | <gh_stars>0
"""Translate strings to and from SOAP 1.2 XML name encoding
Implements rules for mapping application defined name to XML names
specified by the w3 SOAP working group for SOAP version 1.2 in
Appendix A of "SOAP Version 1.2 Part 2: Adjuncts", W3C Working Draft
17, December 2001, <http://www.w3.org/TR/so... | """Translate strings to and from SOAP 1.2 XML name encoding
Implements rules for mapping application defined name to XML names
specified by the w3 SOAP working group for SOAP version 1.2 in
Appendix A of "SOAP Version 1.2 Part 2: Adjuncts", W3C Working Draft
17, December 2001, <http://www.w3.org/TR/soap12-part2/#... | en | 0.698129 | Translate strings to and from SOAP 1.2 XML name encoding
Implements rules for mapping application defined name to XML names
specified by the w3 SOAP working group for SOAP version 1.2 in
Appendix A of "SOAP Version 1.2 Part 2: Adjuncts", W3C Working Draft
17, December 2001, <http://www.w3.org/TR/soap12-part2/#nam... | 2.975713 | 3 |
mmtbx/validation/regression/tst_restraints.py | dperl-sol/cctbx_project | 155 | 11813 | <reponame>dperl-sol/cctbx_project<gh_stars>100-1000
from __future__ import absolute_import, division, print_function
from libtbx.utils import null_out
from libtbx import easy_pickle
from six.moves import cStringIO as StringIO
def run_validation(pdb_file, ignore_hd=True):
from mmtbx.validation import restraints
im... | from __future__ import absolute_import, division, print_function
from libtbx.utils import null_out
from libtbx import easy_pickle
from six.moves import cStringIO as StringIO
def run_validation(pdb_file, ignore_hd=True):
from mmtbx.validation import restraints
import mmtbx.command_line
cmdline = mmtbx.command_lin... | en | 0.362968 | # extracted from 1lyz, with hydrogens from reduce ATOM 1 N LYS A 1 3.296 9.888 10.739 1.00 7.00 N ATOM 2 CA LYS A 1 2.439 10.217 9.791 1.00 6.00 C ATOM 3 C LYS A 1 2.439 11.997 9.160 1.00 6.00 C ATOM 4 O LYS A 1 ... | 1.864472 | 2 |
Python/repeated-dna-sequences.py | sm2774us/leetcode_interview_prep_2021 | 0 | 11814 | <reponame>sm2774us/leetcode_interview_prep_2021
# Time: O(n)
# Space: O(n)
import collections
class Solution(object):
def findRepeatedDnaSequences(self, s):
"""
:type s: str
:rtype: List[str]
"""
dict, rolling_hash, res = {}, 0, []
for i in range(len(s)):
... | # Time: O(n)
# Space: O(n)
import collections
class Solution(object):
def findRepeatedDnaSequences(self, s):
"""
:type s: str
:rtype: List[str]
"""
dict, rolling_hash, res = {}, 0, []
for i in range(len(s)):
rolling_hash = ((rolling_hash << 3) & 0x3fff... | en | 0.257283 | # Time: O(n) # Space: O(n) :type s: str :rtype: List[str] :type s: str :rtype: List[str] | 3.309972 | 3 |
recipe/app.py | Udayan-Coding/examples | 1 | 11815 | from flask import Flask, render_template, request
app = Flask(__name__)
@app.route("/")
def hello():
return render_template("index.html", name="WORLD!")
@app.route("/about")
def about():
return render_template("about.html")
| from flask import Flask, render_template, request
app = Flask(__name__)
@app.route("/")
def hello():
return render_template("index.html", name="WORLD!")
@app.route("/about")
def about():
return render_template("about.html")
| none | 1 | 2.854437 | 3 | |
step2.py | mosheliv/tfcollab1 | 0 | 11816 | <reponame>mosheliv/tfcollab1<gh_stars>0
"""
Usage:
# From tensorflow/models/
# Create train data:
python generate_tfrecord.py --csv_input=data/train_labels.csv --output_path=train.record
# Create test data:
python generate_tfrecord.py --csv_input=data/test_labels.csv --output_path=test.record
"""
from __fu... | """
Usage:
# From tensorflow/models/
# Create train data:
python generate_tfrecord.py --csv_input=data/train_labels.csv --output_path=train.record
# Create test data:
python generate_tfrecord.py --csv_input=data/test_labels.csv --output_path=test.record
"""
from __future__ import division
from __future__ i... | en | 0.186526 | Usage: # From tensorflow/models/ # Create train data: python generate_tfrecord.py --csv_input=data/train_labels.csv --output_path=train.record # Create test data: python generate_tfrecord.py --csv_input=data/test_labels.csv --output_path=test.record # TO-DO replace this with label map | 2.710473 | 3 |
lh_lib/sensors/esp32/touch.py | lh70/s-connect-python | 0 | 11817 | <gh_stars>0
from machine import Pin
from lh_lib.sensors.sensor import AbstractSensor
class Touch(AbstractSensor):
"""
This represents a touch sensor with integrated Logic, where there is only one output pin,
which digitally represents the touched state.
pin:integer can be one of all available GPIO ... | from machine import Pin
from lh_lib.sensors.sensor import AbstractSensor
class Touch(AbstractSensor):
"""
This represents a touch sensor with integrated Logic, where there is only one output pin,
which digitally represents the touched state.
pin:integer can be one of all available GPIO pins: 0-19, ... | en | 0.888638 | This represents a touch sensor with integrated Logic, where there is only one output pin, which digitally represents the touched state. pin:integer can be one of all available GPIO pins: 0-19, 21-23, 25-27, 32-39 it is NOT recommended to pick one of the following pins: (1, 3) -> serial, (6, 7, ... | 3.586285 | 4 |
algorithms/python/118.py | viing937/leetcode | 3 | 11818 | <filename>algorithms/python/118.py
class Solution:
def generate(self, numRows):
"""
:type numRows: int
:rtype: List[List[int]]
"""
if numRows == 0: return []
rls = [[1]]
for i in range(2, numRows+1):
row = [1] * i
for j in range(1, i-1)... | <filename>algorithms/python/118.py
class Solution:
def generate(self, numRows):
"""
:type numRows: int
:rtype: List[List[int]]
"""
if numRows == 0: return []
rls = [[1]]
for i in range(2, numRows+1):
row = [1] * i
for j in range(1, i-1)... | en | 0.152556 | :type numRows: int :rtype: List[List[int]] | 3.619347 | 4 |
squeeze_and_excitation_networks/datasets/data_loader.py | younnggsuk/CV-Paper-Implementation | 4 | 11819 | import os
import cv2
import albumentations as A
from albumentations.pytorch import ToTensorV2
from torch.utils.data import Dataset, DataLoader
from sklearn.model_selection import train_test_split
__all__ = ['CatDogDataset', 'fetch_dataloader']
class CatDogDataset(Dataset):
def __init__(self, file_paths, ... | import os
import cv2
import albumentations as A
from albumentations.pytorch import ToTensorV2
from torch.utils.data import Dataset, DataLoader
from sklearn.model_selection import train_test_split
__all__ = ['CatDogDataset', 'fetch_dataloader']
class CatDogDataset(Dataset):
def __init__(self, file_paths, ... | none | 1 | 2.54248 | 3 | |
seq2seq_utils.py | mumbihere/summarizer | 0 | 11820 | <reponame>mumbihere/summarizer
from keras.preprocessing.text import text_to_word_sequence
from keras.models import Sequential
from keras.layers import Activation, TimeDistributed, Dense, RepeatVector, recurrent, Embedding
from keras.layers.recurrent import LSTM
from keras.optimizers import Adam, RMSprop
from nltk impor... | from keras.preprocessing.text import text_to_word_sequence
from keras.models import Sequential
from keras.layers import Activation, TimeDistributed, Dense, RepeatVector, recurrent, Embedding
from keras.layers.recurrent import LSTM
from keras.optimizers import Adam, RMSprop
from nltk import FreqDist
import numpy as np
i... | en | 0.811965 | # Reading raw text from source and destination files # Splitting raw text into array of sequences # Creating the vocabulary set with the most common words # Creating an array of words from the vocabulary set, we will use this array as index-to-word dictionary # Adding the word "ZERO" to the beginning of the array # Add... | 2.980154 | 3 |
SAMAE/data/__init__.py | Lisa-pa/SAMAE | 0 | 11821 | <reponame>Lisa-pa/SAMAE
"""Standard test images.
"""
import os
from skimage.io import imread
data_dir = os.path.abspath(os.path.dirname(__file__))
__all__ = ['data_dir', 'circle', 'skmuscimg']
def _load(f, as_gray=False):
"""Load an image file located in the data directory.
Parameters
----------
... | """Standard test images.
"""
import os
from skimage.io import imread
data_dir = os.path.abspath(os.path.dirname(__file__))
__all__ = ['data_dir', 'circle', 'skmuscimg']
def _load(f, as_gray=False):
"""Load an image file located in the data directory.
Parameters
----------
f : string
File... | en | 0.740129 | Standard test images. Load an image file located in the data directory. Parameters ---------- f : string File name. as_gray : bool, optional Whether to convert the image to grayscale. Returns ------- img : ndarray Image loaded from ``data_dir``. # importing io is quit... | 2.899981 | 3 |
pandas_support/test_pandas_support.py | quanbingDG/sharper | 0 | 11822 | <filename>pandas_support/test_pandas_support.py<gh_stars>0
# -*- coding: utf-8 -*-
# @Time : 2020/11/9 9:13 下午
# @Author : quanbing
# @Email : <EMAIL>
import pandas as pd
import numpy as np
from unittest import TestCase
from pandas_support import PandasSupport as PS
# @File : test_pandas_support.py
class TestPandasSu... | <filename>pandas_support/test_pandas_support.py<gh_stars>0
# -*- coding: utf-8 -*-
# @Time : 2020/11/9 9:13 下午
# @Author : quanbing
# @Email : <EMAIL>
import pandas as pd
import numpy as np
from unittest import TestCase
from pandas_support import PandasSupport as PS
# @File : test_pandas_support.py
class TestPandasSu... | fr | 0.292564 | # -*- coding: utf-8 -*- # @Time : 2020/11/9 9:13 下午 # @Author : quanbing # @Email : <EMAIL> # @File : test_pandas_support.py | 2.627252 | 3 |
08-About_scrapy/douban/main.py | jiaxiaochu/spider | 0 | 11823 | <reponame>jiaxiaochu/spider
# !/Library/Frameworks/Python.framework/Versions/3.7/bin/python3
# -*- coding:utf-8 -*-
# @Author : Jiazhixiang
# 导入cmdline模块,可以实现控制终端命令行。
from scrapy import cmdline
# 用execute()方法,输入运行scrapy的命令。
cmdline.execute(['scrapy', 'crawl', 'douban'])
| # !/Library/Frameworks/Python.framework/Versions/3.7/bin/python3
# -*- coding:utf-8 -*-
# @Author : Jiazhixiang
# 导入cmdline模块,可以实现控制终端命令行。
from scrapy import cmdline
# 用execute()方法,输入运行scrapy的命令。
cmdline.execute(['scrapy', 'crawl', 'douban']) | zh | 0.673635 | # !/Library/Frameworks/Python.framework/Versions/3.7/bin/python3 # -*- coding:utf-8 -*- # @Author : Jiazhixiang # 导入cmdline模块,可以实现控制终端命令行。 # 用execute()方法,输入运行scrapy的命令。 | 1.702453 | 2 |
DynamicProgramming/longestIncreasingSubsequence.py | suyash248/data_structures | 7 | 11824 | <reponame>suyash248/data_structures
from Array import empty_1d_array
"""
input array : [10, 22, 9, 33, 21, 50, 41, 60]
# Element at each index `i` is representing length of longest LIS from index 0 to i in input array.
output array: [1, 2, 1, 3, 2, 4, 4, 5]
"""
# Time complexity: O(n^2)
# Space complexity... | from Array import empty_1d_array
"""
input array : [10, 22, 9, 33, 21, 50, 41, 60]
# Element at each index `i` is representing length of longest LIS from index 0 to i in input array.
output array: [1, 2, 1, 3, 2, 4, 4, 5]
"""
# Time complexity: O(n^2)
# Space complexity: O(n)
def lis_dp(arr):
# Length... | en | 0.735479 | input array : [10, 22, 9, 33, 21, 50, 41, 60] # Element at each index `i` is representing length of longest LIS from index 0 to i in input array. output array: [1, 2, 1, 3, 2, 4, 4, 5] # Time complexity: O(n^2) # Space complexity: O(n) # Length of LIS at each index is at least 1 (element itself). # for i=1; i<n;... | 3.710966 | 4 |
venv/Lib/site-packages/gevent/backdoor.py | Kiiwi/Syssel | 0 | 11825 | <reponame>Kiiwi/Syssel
# Copyright (c) 2009-2014, gevent contributors
# Based on eventlet.backdoor Copyright (c) 2005-2006, <NAME>
from __future__ import print_function
import sys
from code import InteractiveConsole
from gevent import socket
from gevent.greenlet import Greenlet
from gevent.hub import PY3, PYPY, getcu... | # Copyright (c) 2009-2014, gevent contributors
# Based on eventlet.backdoor Copyright (c) 2005-2006, <NAME>
from __future__ import print_function
import sys
from code import InteractiveConsole
from gevent import socket
from gevent.greenlet import Greenlet
from gevent.hub import PY3, PYPY, getcurrent
from gevent.serve... | en | 0.726255 | # Copyright (c) 2009-2014, gevent contributors # Based on eventlet.backdoor Copyright (c) 2005-2006, <NAME> # XXX why is this necessary? Provide a backdoor to a program for debugging purposes. You may bind to any interface, but for security purposes it is recommended that you bind to 127.0.0.1. Basic usag... | 2.521168 | 3 |
spark/par_decompress_audio.py | droyston/spectralize | 0 | 11826 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Wed Jun 17 16:12:56 2020
@author: dylanroyston
"""
# import/configure packages
import numpy as np
import pandas as pd
#import pyarrow as pa
import librosa
import librosa.display
from pathlib import Path
#import Ipython.display as ipd
#import matplotlib.pyp... | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Wed Jun 17 16:12:56 2020
@author: dylanroyston
"""
# import/configure packages
import numpy as np
import pandas as pd
#import pyarrow as pa
import librosa
import librosa.display
from pathlib import Path
#import Ipython.display as ipd
#import matplotlib.pyp... | en | 0.510836 | #!/usr/bin/env python3 # -*- coding: utf-8 -*- Created on Wed Jun 17 16:12:56 2020 @author: dylanroyston # import/configure packages #import pyarrow as pa #import Ipython.display as ipd #import matplotlib.pyplot as plt #from io import BytesIO #import config ##### # create local Spark instance (for non-cluster dev) # d... | 2.089088 | 2 |
get_ip_list_ru_gov.py | gil9red/SimplePyScripts | 117 | 11827 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
__author__ = 'ipetrash'
"""
Скрипт выводит список ip государственных организаций.
"""
import ipaddress
import sys
import requests
rs = requests.get('https://jarib.github.io/anon-history/RuGovEdits/ru/latest/ranges.json')
# Проверка удачного запроса и полученных д... | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
__author__ = 'ipetrash'
"""
Скрипт выводит список ip государственных организаций.
"""
import ipaddress
import sys
import requests
rs = requests.get('https://jarib.github.io/anon-history/RuGovEdits/ru/latest/ranges.json')
# Проверка удачного запроса и полученных д... | ru | 0.972208 | #!/usr/bin/env python3 # -*- coding: utf-8 -*- Скрипт выводит список ip государственных организаций. # Проверка удачного запроса и полученных данных # Получение и сортировка элементов по названию организации # Получение ip с маской подсети # Получение ip подсети # Перебор ip адресов указанной организации | 2.796474 | 3 |
test_collection.py | Rodrun/weatherguess | 0 | 11828 | <gh_stars>0
import unittest
import requests
from collection import Collection
class TestCollection(unittest.TestCase):
def setUp(self):
# Get the sample JSON data
self.data = requests.get("http://samples.openweathermap.org/data/2.5/weather?zip=94040,us&appid=b6907d289e10d714a6e88b30761fae22").jso... | import unittest
import requests
from collection import Collection
class TestCollection(unittest.TestCase):
def setUp(self):
# Get the sample JSON data
self.data = requests.get("http://samples.openweathermap.org/data/2.5/weather?zip=94040,us&appid=b6907d289e10d714a6e88b30761fae22").json()
... | en | 0.155634 | # Get the sample JSON data Test if get_weather returns a list of the default value when given None. Test if get_weather functions correctly. Test if get_weather functions correctly using the default getlist. | 3.540894 | 4 |
tests/bitwiseOperations/__init__.py | mgorzkowski/abn | 4 | 11829 | from . import nand_tests
from . import and_tests
from . import nor_tests
from . import not_tests
from . import or_tests
from . import xor_tests
from . import rotate_left_tests
from . import rotate_right_tests
from . import shift_left_tests
from . import shift_right_tests
| from . import nand_tests
from . import and_tests
from . import nor_tests
from . import not_tests
from . import or_tests
from . import xor_tests
from . import rotate_left_tests
from . import rotate_right_tests
from . import shift_left_tests
from . import shift_right_tests
| none | 1 | 1.087244 | 1 | |
exot/util/misc.py | ETHZ-TEC/exot_eengine | 0 | 11830 | # Copyright (c) 2015-2020, Swiss Federal Institute of Technology (ETH Zurich)
# 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... | # Copyright (c) 2015-2020, Swiss Federal Institute of Technology (ETH Zurich)
# 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... | en | 0.642441 | # Copyright (c) 2015-2020, Swiss Federal Institute of Technology (ETH Zurich) # 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 n... | 1.256817 | 1 |
70_question/dynamic_programming/max_profit_with_k_transactions.py | alvinctk/google-tech-dev-guide | 26 | 11831 | <reponame>alvinctk/google-tech-dev-guide
def maxProfitWithKTransactions(prices, k):
n = len(prices)
profit = [[0]*n for _ in range(k+1)]
"""
t := number of transactions
d := day at which either buy/sell stock
profit[t][d] = max ( previous day profit = profit[t][d-1] ,
... | def maxProfitWithKTransactions(prices, k):
n = len(prices)
profit = [[0]*n for _ in range(k+1)]
"""
t := number of transactions
d := day at which either buy/sell stock
profit[t][d] = max ( previous day profit = profit[t][d-1] ,
profit sold at this day + max(buy for th... | en | 0.808921 | t := number of transactions d := day at which either buy/sell stock profit[t][d] = max ( previous day profit = profit[t][d-1] , profit sold at this day + max(buy for this transaction + profit at last transaction) prices[d] + max(-prices[x] + profit[t-1][x], wh... | 3.435732 | 3 |
main.py | rdmaulana/flask-smart-xls-clean | 0 | 11832 | <filename>main.py
import pandas as pd
import numpy as np
import io
import time
import uuid
from flask import Flask, render_template, request, redirect, url_for, Response, session, send_file, make_response, send_from_directory
from os.path import join, dirname, realpath
from werkzeug.wsgi import FileWrapper
app = Flas... | <filename>main.py
import pandas as pd
import numpy as np
import io
import time
import uuid
from flask import Flask, render_template, request, redirect, url_for, Response, session, send_file, make_response, send_from_directory
from os.path import join, dirname, realpath
from werkzeug.wsgi import FileWrapper
app = Flas... | it | 0.667782 | # del xls['NO'] | 2.463224 | 2 |
2_UNIXCommands/Exercise11.py | takeyoshinitta/NLP-100-Exercise | 3 | 11833 | # 11. Replace tabs into spaces
# Replace every occurrence of a tab character into a space. Confirm the result by using sed, tr, or expand command.
with open('popular-names.txt') as f:
for line in f:
print(line.strip().replace("\t", " "))
| # 11. Replace tabs into spaces
# Replace every occurrence of a tab character into a space. Confirm the result by using sed, tr, or expand command.
with open('popular-names.txt') as f:
for line in f:
print(line.strip().replace("\t", " "))
| en | 0.821724 | # 11. Replace tabs into spaces # Replace every occurrence of a tab character into a space. Confirm the result by using sed, tr, or expand command. | 3.276512 | 3 |
scripts/wapo/wapo_link_graph_from_mongo.py | feup-infolab/army-ant | 5 | 11834 | <filename>scripts/wapo/wapo_link_graph_from_mongo.py
#!/usr/bin/env python
#
# wapo_link_graph_from_mongo.py
# <NAME> <<EMAIL>>
# 2019-02-05
import logging
import sys
import warnings
import networkx as nx
from bs4 import BeautifulSoup
from pymongo import MongoClient
logging.basicConfig(
format='%(asctime)s wapo... | <filename>scripts/wapo/wapo_link_graph_from_mongo.py
#!/usr/bin/env python
#
# wapo_link_graph_from_mongo.py
# <NAME> <<EMAIL>>
# 2019-02-05
import logging
import sys
import warnings
import networkx as nx
from bs4 import BeautifulSoup
from pymongo import MongoClient
logging.basicConfig(
format='%(asctime)s wapo... | en | 0.088661 | #!/usr/bin/env python # # wapo_link_graph_from_mongo.py # <NAME> <<EMAIL>> # 2019-02-05 # graph[source_url].add(target_url) | 2.658233 | 3 |
designScripts/vernierMask.py | smartalecH/BYUqot | 5 | 11835 | <gh_stars>1-10
# ------------------------------------------------------------------ #
# vernierMask.py
# ------------------------------------------------------------------ #
#
# A mask design used to align the 3D printer to a silicon photonic chip
#
# ------------------------------------------------------------------ #... | # ------------------------------------------------------------------ #
# vernierMask.py
# ------------------------------------------------------------------ #
#
# A mask design used to align the 3D printer to a silicon photonic chip
#
# ------------------------------------------------------------------ #
# VERSION HIST... | en | 0.421838 | # ------------------------------------------------------------------ # # vernierMask.py # ------------------------------------------------------------------ # # # A mask design used to align the 3D printer to a silicon photonic chip # # ------------------------------------------------------------------ # # VERSION HIST... | 1.974239 | 2 |
src/core/serializers.py | pradipta/back-end | 17 | 11836 | from django.contrib.auth import get_user_model
from rest_auth.registration.serializers import (
RegisterSerializer as BaseRegisterSerializer,
)
from rest_auth.registration.serializers import (
SocialLoginSerializer as BaseSocialLoginSerializer,
)
from rest_auth.serializers import LoginSerializer as BaseLoginSer... | from django.contrib.auth import get_user_model
from rest_auth.registration.serializers import (
RegisterSerializer as BaseRegisterSerializer,
)
from rest_auth.registration.serializers import (
SocialLoginSerializer as BaseSocialLoginSerializer,
)
from rest_auth.serializers import LoginSerializer as BaseLoginSer... | en | 0.477334 | # noinspection PyAbstractClass Extends the default LoginSerializer in order to return custom error messages # noinspection PyAbstractClass Extends the default PasswordResetConfirmSerializer in order to return custom error messages # noinspection PyAbstractClass Extends default SocialLoginSerializer to add addit... | 2.148788 | 2 |
src/programy/brainfactory.py | motazsaad/fit-bot-fb-clt | 0 | 11837 | <filename>src/programy/brainfactory.py
"""
Copyright (c) 2016-2019 <NAME> http://www.keithsterling.com
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 limita... | <filename>src/programy/brainfactory.py
"""
Copyright (c) 2016-2019 <NAME> http://www.keithsterling.com
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 limita... | en | 0.754276 | Copyright (c) 2016-2019 <NAME> http://www.keithsterling.com Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge... | 2.080217 | 2 |
tools/docs/generate_api_rst.py | dcillera/envoy | 17,703 | 11838 | import os
import shutil
import sys
import tarfile
def include_package(envoy_api_protos, rst_file_path, prefix):
# `envoy_api_rst_files` is a list of file paths for .proto.rst files
# generated by protodoc
#
# we are only interested in the proto files generated for envoy protos,
# not for non-envoy... | import os
import shutil
import sys
import tarfile
def include_package(envoy_api_protos, rst_file_path, prefix):
# `envoy_api_rst_files` is a list of file paths for .proto.rst files
# generated by protodoc
#
# we are only interested in the proto files generated for envoy protos,
# not for non-envoy... | en | 0.764492 | # `envoy_api_rst_files` is a list of file paths for .proto.rst files # generated by protodoc # # we are only interested in the proto files generated for envoy protos, # not for non-envoy dependencies # derive the "canonical" path from the filepath # we are only interested in the actual v3 protos, not their dependencies... | 2.17386 | 2 |
src/wa_parser.py | ifly6/NS-WA-Authorboards | 0 | 11839 | <reponame>ifly6/NS-WA-Authorboards
# Copyright (c) 2020 ifly6
import html
import io
import re
from datetime import datetime
from functools import cache
from typing import Tuple
import numpy as np
import pandas as pd
import requests
from bs4 import BeautifulSoup
from lxml import etree
from pytz import timezone
from rat... | # Copyright (c) 2020 ifly6
import html
import io
import re
from datetime import datetime
from functools import cache
from typing import Tuple
import numpy as np
import pandas as pd
import requests
from bs4 import BeautifulSoup
from lxml import etree
from pytz import timezone
from ratelimit import limits, sleep_and_ret... | en | 0.860049 | # Copyright (c) 2020 ifly6 Imperium Anglorum: This is adapted from proprietary InfoEurope code which in part does most of this already. Eg the proposal portions which translate, the locality adjustments, API reading, etc. There is also code in beta (not-in-production) which would have done this entirely, but I never ... | 2.642224 | 3 |
conans/search/binary_html_table.py | matthiasng/conan | 2 | 11840 | import os
from collections import OrderedDict, defaultdict
from conans.model.ref import PackageReference
from conans.util.files import save
class RowResult(object):
def __init__(self, remote, reference, data):
self.remote = remote
self.reference = reference
self._data = data
@propert... | import os
from collections import OrderedDict, defaultdict
from conans.model.ref import PackageReference
from conans.util.files import save
class RowResult(object):
def __init__(self, remote, reference, data):
self.remote = remote
self.reference = reference
self._data = data
@propert... | en | 0.63406 | Returns package data according to headers # Keys: columns to classify # - Order settings Retrieve list of headers as a single list (1-row) or as a list of tuples with settings organized by categories (2-row). Example output: 1-row: ['os', 'arch', 'compiler', 'compiler.version', 'compiler.li... | 2.403185 | 2 |
irancovid-19.py | AmiiirCom/irancovid-19 | 0 | 11841 | <reponame>AmiiirCom/irancovid-19
from covid import Covid
import json
covid = Covid(source="worldometers")
covid.get_data()
iran_casses = covid.get_status_by_country_name("iran")
confirmed = iran_casses['confirmed']
new_cases = iran_casses['new_cases']
deaths = iran_casses['deaths']
recovered = iran_casses['recovered... | from covid import Covid
import json
covid = Covid(source="worldometers")
covid.get_data()
iran_casses = covid.get_status_by_country_name("iran")
confirmed = iran_casses['confirmed']
new_cases = iran_casses['new_cases']
deaths = iran_casses['deaths']
recovered = iran_casses['recovered']
active = iran_casses['active']... | none | 1 | 2.859373 | 3 | |
models/__init__.py | esentino/literate-doodle | 0 | 11842 | <reponame>esentino/literate-doodle<gh_stars>0
# models/__init__.py
from clcrypto import password_hash
from psycopg2 import connect
def make_connection(db_name='w3'):
cnx = connect(user='postgres', password='<PASSWORD>', database=db_name, host='localhost')
cnx.autocommit = True
return cnx
class User:
... | # models/__init__.py
from clcrypto import password_hash
from psycopg2 import connect
def make_connection(db_name='w3'):
cnx = connect(user='postgres', password='<PASSWORD>', database=db_name, host='localhost')
cnx.autocommit = True
return cnx
class User:
__id = None
username = None
__hashed_... | en | 0.221482 | # models/__init__.py # saving new instance using prepared statements INSERT INTO Users(username, email, hashed_password) VALUES(%s, %s, %s) RETURNING id # albo cursor.fetchone()['id'] UPDATE Users SET username=%s, email=%s, hashed_password=%s WHERE id=%s # (user_id, ) - ... | 3.090031 | 3 |
crys3d/command_line/model_viewer.py | rimmartin/cctbx_project | 0 | 11843 | from __future__ import division
# LIBTBX_PRE_DISPATCHER_INCLUDE_SH export PHENIX_GUI_ENVIRONMENT=1
# LIBTBX_PRE_DISPATCHER_INCLUDE_SH export BOOST_ADAPTBX_FPE_DEFAULT=1
import cStringIO
from crys3d.wx_selection_editor import selection_editor_mixin
import wx
import libtbx.load_env
import sys, os, time
################... | from __future__ import division
# LIBTBX_PRE_DISPATCHER_INCLUDE_SH export PHENIX_GUI_ENVIRONMENT=1
# LIBTBX_PRE_DISPATCHER_INCLUDE_SH export BOOST_ADAPTBX_FPE_DEFAULT=1
import cStringIO
from crys3d.wx_selection_editor import selection_editor_mixin
import wx
import libtbx.load_env
import sys, os, time
################... | en | 0.227479 | # LIBTBX_PRE_DISPATCHER_INCLUDE_SH export PHENIX_GUI_ENVIRONMENT=1 # LIBTBX_PRE_DISPATCHER_INCLUDE_SH export BOOST_ADAPTBX_FPE_DEFAULT=1 ######################################################################## # CLASSES AND METHODS FOR STANDALONE VIEWER # | 1.780112 | 2 |
Crypto/py3compat.py | eddiejessup/transcrypt | 14 | 11844 | <reponame>eddiejessup/transcrypt
__revision__ = "$Id$"
def b(s):
return s.encode("latin-1")
def bchr(s):
return bytes([s])
def bstr(s):
if isinstance(s, str):
return bytes(s, "latin-1")
else:
return bytes(s)
def bord(s):
return s
def tobytes(s):
if isinstance(s, bytes):... | __revision__ = "$Id$"
def b(s):
return s.encode("latin-1")
def bchr(s):
return bytes([s])
def bstr(s):
if isinstance(s, str):
return bytes(s, "latin-1")
else:
return bytes(s)
def bord(s):
return s
def tobytes(s):
if isinstance(s, bytes):
return s
else:
... | none | 1 | 2.391071 | 2 | |
verres/optim/schedule.py | csxeba/Verres | 0 | 11845 | from typing import Dict
import numpy as np
import tensorflow as tf
import verres as V
class ConstantSchedule(tf.keras.optimizers.schedules.LearningRateSchedule):
def __init__(self, learning_rate: float):
super().__init__()
self.learning_rate = float(learning_rate)
def __call__(self, step):... | from typing import Dict
import numpy as np
import tensorflow as tf
import verres as V
class ConstantSchedule(tf.keras.optimizers.schedules.LearningRateSchedule):
def __init__(self, learning_rate: float):
super().__init__()
self.learning_rate = float(learning_rate)
def __call__(self, step):... | none | 1 | 2.554993 | 3 | |
JIG.py | mmg1/JIG | 28 | 11846 | <reponame>mmg1/JIG
import re
import sys
from itertools import izip as zip
import argparse
import requests
# argparse definitions
parser = argparse.ArgumentParser(description='Jira attack script')
parser.add_argument('URL', type=str , help='the URL of the Jira instance... ex. https://jira.organization.com/')
p... | import re
import sys
from itertools import izip as zip
import argparse
import requests
# argparse definitions
parser = argparse.ArgumentParser(description='Jira attack script')
parser.add_argument('URL', type=str , help='the URL of the Jira instance... ex. https://jira.organization.com/')
parser.add_argument(... | en | 0.691582 | # argparse definitions # Define URLs #dashboardURL = args.URL + "secure/Dashboard.jspa" Takes in the response body for UserBrowserPicker and returns a dictionary containing
usernames and email addresses. Takes in the response body for the manage filters page and returns a list containing usernames. Runs a stream o... | 3.157001 | 3 |
run.py | SamChatfield/final-year-project | 0 | 11847 | import json
import string
from datetime import datetime
import deap
import numpy as np
import hmm
from discriminator import Discriminator
from ea import EA
import random_search
DEFAULT_PARAMS = {
# Discriminator CNN model
"model": "CNNModel3",
# Algorithm Parameters
"states": 5,
"symbols": 5,
... | import json
import string
from datetime import datetime
import deap
import numpy as np
import hmm
from discriminator import Discriminator
from ea import EA
import random_search
DEFAULT_PARAMS = {
# Discriminator CNN model
"model": "CNNModel3",
# Algorithm Parameters
"states": 5,
"symbols": 5,
... | en | 0.669723 | # Discriminator CNN model # Algorithm Parameters # None - default to 1/N where N is number of genes # Implementation Parameters # Also run an elitist random search over #gens to compare performance # Overwrite the default values of the provided parameters # Random HMM that will act as the 'true' underlying distribution... | 2.523678 | 3 |
rrc_example_package/benchmark_rrc/tools/plot/exp_align_obj.py | wq13552463699/TriFinger_Research | 12 | 11848 | #!/usr/bin/env python3
'''
This code traverses a directories of evaluation log files and
record evaluation scores as well as plotting the results.
'''
import os
import argparse
import json
import copy
from shutil import copyfile
import pandas as pd
import seaborn as sns
import matplotlib.pyplot as plt
from utils import... | #!/usr/bin/env python3
'''
This code traverses a directories of evaluation log files and
record evaluation scores as well as plotting the results.
'''
import os
import argparse
import json
import copy
from shutil import copyfile
import pandas as pd
import seaborn as sns
import matplotlib.pyplot as plt
from utils import... | en | 0.819427 | #!/usr/bin/env python3 This code traverses a directories of evaluation log files and record evaluation scores as well as plotting the results. # This depends on the evaluation code used to generate the logs Traverse and read log files, and then output csv file from the eval data. - file to be generated: 'eval_score... | 2.633735 | 3 |
test cases/common/64 custom header generator/makeheader.py | objectx/meson | 0 | 11849 | #!/usr/bin/env python3
# NOTE: this file does not have the executable bit set. This tests that
# Meson can automatically parse shebang lines.
import sys
template = '#define RET_VAL %s\n'
output = template % (open(sys.argv[1]).readline().strip())
open(sys.argv[2], 'w').write(output)
| #!/usr/bin/env python3
# NOTE: this file does not have the executable bit set. This tests that
# Meson can automatically parse shebang lines.
import sys
template = '#define RET_VAL %s\n'
output = template % (open(sys.argv[1]).readline().strip())
open(sys.argv[2], 'w').write(output)
| en | 0.762 | #!/usr/bin/env python3 # NOTE: this file does not have the executable bit set. This tests that # Meson can automatically parse shebang lines. | 2.059498 | 2 |
studio_ghibli/movies/test_data.py | hbansal0122/studio_ghibli_project | 0 | 11850 | <filename>studio_ghibli/movies/test_data.py
""" Test data"""
stub_films = [{
"id": "12345",
"title": "This is film one",
},{
"id": "23456",
"title": "This is film two",
}]
stub_poeple = [{
"name": "<NAME>",
"films": ["url/12345", "url/23456"]
},{
"name": "<NAME>",
"films": ["url/23456... | <filename>studio_ghibli/movies/test_data.py
""" Test data"""
stub_films = [{
"id": "12345",
"title": "This is film one",
},{
"id": "23456",
"title": "This is film two",
}]
stub_poeple = [{
"name": "<NAME>",
"films": ["url/12345", "url/23456"]
},{
"name": "<NAME>",
"films": ["url/23456... | none | 1 | 1.596247 | 2 | |
data_converters/fsdbripper/create_new_db.py | osvaldolove/amiberry-api | 0 | 11851 | <reponame>osvaldolove/amiberry-api<gh_stars>0
import sqlite3
from constants import DESTINATION_DB
destination_connection = sqlite3.connect(DESTINATION_DB)
destination_cursor = destination_connection.cursor()
destination_cursor.execute('CREATE TABLE game(uuid, payload)')
| import sqlite3
from constants import DESTINATION_DB
destination_connection = sqlite3.connect(DESTINATION_DB)
destination_cursor = destination_connection.cursor()
destination_cursor.execute('CREATE TABLE game(uuid, payload)') | none | 1 | 2.230025 | 2 | |
upvote/gae/shared/common/json_utils_test.py | cclauss/upvote | 0 | 11852 | <reponame>cclauss/upvote<filename>upvote/gae/shared/common/json_utils_test.py
# Copyright 2017 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://... | # Copyright 2017 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or a... | en | 0.82389 | # Copyright 2017 Google Inc. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or a... | 1.985157 | 2 |
app.py | YukiNagat0/Blog | 1 | 11853 | from os import path
from typing import Union
from datetime import datetime
from flask import Flask, request, redirect, render_template
from flask_wtf import CSRFProtect
from werkzeug.utils import secure_filename
from data import db_session
from data.posts import Posts
from forms.edit_post_form import EditPostForm
... | from os import path
from typing import Union
from datetime import datetime
from flask import Flask, request, redirect, render_template
from flask_wtf import CSRFProtect
from werkzeug.utils import secure_filename
from data import db_session
from data.posts import Posts
from forms.edit_post_form import EditPostForm
... | ru | 0.844402 | # --- Фотография --- # Картинки нет # --- Фотография --- # Добавление поста # редактирование | 2.236135 | 2 |
neon/backends/gpu.py | kashif/neon | 1 | 11854 | # ----------------------------------------------------------------------------
# Copyright 2014 Nervana Systems Inc.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.o... | # ----------------------------------------------------------------------------
# Copyright 2014 Nervana Systems Inc.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.o... | en | 0.697183 | # ---------------------------------------------------------------------------- # Copyright 2014 Nervana Systems Inc. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.o... | 1.91478 | 2 |
test/test_automl/test_automl.py | ihounie/auto-sklearn | 0 | 11855 | # -*- encoding: utf-8 -*-
import os
import pickle
import sys
import time
import glob
import unittest
import unittest.mock
import numpy as np
import pandas as pd
import sklearn.datasets
from smac.scenario.scenario import Scenario
from smac.facade.roar_facade import ROAR
from autosklearn.util.backend import Backend
fro... | # -*- encoding: utf-8 -*-
import os
import pickle
import sys
import time
import glob
import unittest
import unittest.mock
import numpy as np
import pandas as pd
import sklearn.datasets
from smac.scenario.scenario import Scenario
from smac.facade.roar_facade import ROAR
from autosklearn.util.backend import Backend
fro... | en | 0.889268 | # -*- encoding: utf-8 -*- # noqa (E402: module level import not at top of file) # Make sure a valid 2D array is given to automl # Add a resampling strategy as this is required by load_models # Assert at least one model file has been deleted and that there were no # deletion errors # Assert that the files of the models ... | 2.009778 | 2 |
algopy/base_type.py | arthus701/algopy | 54 | 11856 | """
This implements an abstrace base class Ring .
Rationale:
Goal is to separate the datatype specification from the algorithms and containers for the following reasons:
1) It allows to directly use the algorithms *without* overhead. E.g. calling mul(z.data, x.data, y.data)
has much le... | """
This implements an abstrace base class Ring .
Rationale:
Goal is to separate the datatype specification from the algorithms and containers for the following reasons:
1) It allows to directly use the algorithms *without* overhead. E.g. calling mul(z.data, x.data, y.data)
has much le... | en | 0.86299 | This implements an abstrace base class Ring . Rationale: Goal is to separate the datatype specification from the algorithms and containers for the following reasons: 1) It allows to directly use the algorithms *without* overhead. E.g. calling mul(z.data, x.data, y.data) has much less o... | 3.558464 | 4 |
estrutura-repeticao-while/ex062.py | TacilioRodriguez/Python | 0 | 11857 | <filename>estrutura-repeticao-while/ex062.py<gh_stars>0
"""
Melhore o Desafio 061, perguntando para o usuário se ele quer mostrar mais alguns termos.
O programa encerra quando ele disser que quer mostrar 0 termos.
"""
primeiro = int(input('Digite o termo: '))
razao = int(input('Digite a razão: '))
termo = primeiro
con... | <filename>estrutura-repeticao-while/ex062.py<gh_stars>0
"""
Melhore o Desafio 061, perguntando para o usuário se ele quer mostrar mais alguns termos.
O programa encerra quando ele disser que quer mostrar 0 termos.
"""
primeiro = int(input('Digite o termo: '))
razao = int(input('Digite a razão: '))
termo = primeiro
con... | pt | 0.990424 | Melhore o Desafio 061, perguntando para o usuário se ele quer mostrar mais alguns termos. O programa encerra quando ele disser que quer mostrar 0 termos. | 3.706622 | 4 |
Udemy_PythonBootcamp/Sec15_WebScraping.py | gonzalosc2/LearningPython | 0 | 11858 | ####################################
# author: <NAME>
# course: 2020 Complete Python Bootcamps: From Zero to Hero in Python
# purpose: lecture notes
# description: Section 15 - Web Scraping
# other: N/A
####################################
# RULES
# 1. always try to get permission before scraping, otherwise I might be... | ####################################
# author: <NAME>
# course: 2020 Complete Python Bootcamps: From Zero to Hero in Python
# purpose: lecture notes
# description: Section 15 - Web Scraping
# other: N/A
####################################
# RULES
# 1. always try to get permission before scraping, otherwise I might be... | en | 0.815552 | #################################### # author: <NAME> # course: 2020 Complete Python Bootcamps: From Zero to Hero in Python # purpose: lecture notes # description: Section 15 - Web Scraping # other: N/A #################################### # RULES # 1. always try to get permission before scraping, otherwise I might be ... | 4.140508 | 4 |
anchore_engine/analyzers/modules/33_binary_packages.py | dspalmer99/anchore-engine | 0 | 11859 | #!/usr/bin/env python3
import sys
import os
import re
import json
import traceback
import pkg_resources
import tarfile
from collections import OrderedDict
import anchore_engine.analyzers.utils, anchore_engine.utils
def get_python_evidence(tfl, member, memberhash, evidence):
global binary_package_el
full... | #!/usr/bin/env python3
import sys
import os
import re
import json
import traceback
import pkg_resources
import tarfile
from collections import OrderedDict
import anchore_engine.analyzers.utils, anchore_engine.utils
def get_python_evidence(tfl, member, memberhash, evidence):
global binary_package_el
full... | en | 0.616315 | #!/usr/bin/env python3 #define +PY_VERSION +\"*([0-9\.\-_a-zA-Z]+)\"*", line) # Perform any specific checks using prior metadata # read in previous analyzer output for helping to increase accuracy of findings # set up ordered dictionary structure for the runtimes and evidence types # Perform a per file routine to evalu... | 2.122063 | 2 |
SF-home-price-prediction/src/preparation.py | apthomas/SF-home-price-prediction | 0 | 11860 | import pandas as pd
import numpy as np
import csv
import urllib.request
import json
from datetime import datetime
from datetime import timedelta
from sklearn.preprocessing import MinMaxScaler
import web_scrapers
import os
def load_real_estate_data(filename, state_attr, state):
df = pd.read_csv(filename, encoding... | import pandas as pd
import numpy as np
import csv
import urllib.request
import json
from datetime import datetime
from datetime import timedelta
from sklearn.preprocessing import MinMaxScaler
import web_scrapers
import os
def load_real_estate_data(filename, state_attr, state):
df = pd.read_csv(filename, encoding... | en | 0.811272 | # structured with within 5, 10 miles from another zipcode # filter data to only Silicon Valley + San Francisco Zip Codes run before joining dataframes so keys match df_sale_counts_by_zip_silicon_valley.columns = df_sale_counts_by_zip_silicon_valley.columns.str.replace('Sales Counts ', '') df_sale_counts_by_zip... | 2.971756 | 3 |
src/python/director/builtin/plugins/measurement_tool/plugin.py | afdaniele/director | 0 | 11861 | from director.devel.plugin import GenericPlugin
from director.fieldcontainer import FieldContainer
from .lib import measurementpanel
from PythonQt import QtCore
class Plugin(GenericPlugin):
ID = 'measurement_tool'
NAME = 'MeasurementTool'
DEPENDENCIES = ['MainWindow']
def __init__(self, app, view):
sup... | from director.devel.plugin import GenericPlugin
from director.fieldcontainer import FieldContainer
from .lib import measurementpanel
from PythonQt import QtCore
class Plugin(GenericPlugin):
ID = 'measurement_tool'
NAME = 'MeasurementTool'
DEPENDENCIES = ['MainWindow']
def __init__(self, app, view):
sup... | none | 1 | 1.937119 | 2 | |
jupyter_book/yaml.py | akhmerov/jupyter-book | 1 | 11862 | <gh_stars>1-10
"""A small sphinx extension to let you configure a site with YAML metadata."""
from pathlib import Path
# Transform a "Jupyter Book" YAML configuration file into a Sphinx configuration file.
# This is so that we can choose more user-friendly words for things than Sphinx uses.
# e.g., 'logo' instead of ... | """A small sphinx extension to let you configure a site with YAML metadata."""
from pathlib import Path
# Transform a "Jupyter Book" YAML configuration file into a Sphinx configuration file.
# This is so that we can choose more user-friendly words for things than Sphinx uses.
# e.g., 'logo' instead of 'html_logo'.
# ... | en | 0.727599 | A small sphinx extension to let you configure a site with YAML metadata. # Transform a "Jupyter Book" YAML configuration file into a Sphinx configuration file. # This is so that we can choose more user-friendly words for things than Sphinx uses. # e.g., 'logo' instead of 'html_logo'. # Note that this should only be use... | 2.695441 | 3 |
ScriptedAgent.py | RaphaelRoyerRivard/Supervised-End-to-end-Weight-sharing-for-StarCraft-II | 0 | 11863 | __author__ = '<NAME> - www.tonybeltramelli.com'
# scripted agents taken from PySC2, credits to DeepMind
# https://github.com/deepmind/pysc2/blob/master/pysc2/agents/scripted_agent.py
import numpy as np
import uuid
from pysc2.agents import base_agent
from pysc2.lib import actions
from pysc2.lib import features
_SCREE... | __author__ = '<NAME> - www.tonybeltramelli.com'
# scripted agents taken from PySC2, credits to DeepMind
# https://github.com/deepmind/pysc2/blob/master/pysc2/agents/scripted_agent.py
import numpy as np
import uuid
from pysc2.agents import base_agent
from pysc2.lib import actions
from pysc2.lib import features
_SCREE... | en | 0.679477 | # scripted agents taken from PySC2, credits to DeepMind # https://github.com/deepmind/pysc2/blob/master/pysc2/agents/scripted_agent.py # we expand dims because keras wants 4 dims for convolutions # observation = np.expand_dims(obs.observation["screen"][_SCREEN_PLAYER_RELATIVE], axis=3) | 2.469741 | 2 |
benchmark/test_tpch.py | serverless-analytics/dask-distributed-vanilla | 0 | 11864 | import time
import sys
import dask
from dask.distributed import (
wait,
futures_of,
Client,
)
from tpch import loaddata, queries
#from benchmarks import utils
# Paths or URLs to the TPC-H tables.
#table_paths = {
# 'CUSTOMER': 'hdfs://bu-23-115:9000/tpch/customer.tbl',
# 'LINEITEM': 'hdfs://bu-... | import time
import sys
import dask
from dask.distributed import (
wait,
futures_of,
Client,
)
from tpch import loaddata, queries
#from benchmarks import utils
# Paths or URLs to the TPC-H tables.
#table_paths = {
# 'CUSTOMER': 'hdfs://bu-23-115:9000/tpch/customer.tbl',
# 'LINEITEM': 'hdfs://bu-... | en | 0.276859 | #from benchmarks import utils # Paths or URLs to the TPC-H tables. #table_paths = { # 'CUSTOMER': 'hdfs://bu-23-115:9000/tpch/customer.tbl', # 'LINEITEM': 'hdfs://bu-23-115:9000/tpch/lineitem.tbl', # 'NATION': 'hdfs://bu-23-115:9000/tpch/nation.tbl', # 'ORDERS': 'hdfs://bu-23-115:9000/tpch/orders.tbl', ... | 2.05108 | 2 |
pika/adapters/tornado_connection.py | hugovk/pika | 1 | 11865 | """Use pika with the Tornado IOLoop
"""
import logging
from tornado import ioloop
from pika.adapters.utils import nbio_interface, selector_ioloop_adapter
from pika.adapters import base_connection
LOGGER = logging.getLogger(__name__)
class TornadoConnection(base_connection.BaseConnection):
"""The TornadoConne... | """Use pika with the Tornado IOLoop
"""
import logging
from tornado import ioloop
from pika.adapters.utils import nbio_interface, selector_ioloop_adapter
from pika.adapters import base_connection
LOGGER = logging.getLogger(__name__)
class TornadoConnection(base_connection.BaseConnection):
"""The TornadoConne... | en | 0.737545 | Use pika with the Tornado IOLoop The TornadoConnection runs on the Tornado IOLoop. Create a new instance of the TornadoConnection class, connecting to RabbitMQ automatically :param pika.connection.Parameters parameters: Connection parameters :param on_open_callback: The method to call when the ... | 2.488338 | 2 |
tests/library/test_ceph_volume_simple_activate.py | u-kosmonaft-u/ceph-ansible | 1,570 | 11866 | from mock.mock import patch
import os
import pytest
import ca_test_common
import ceph_volume_simple_activate
fake_cluster = 'ceph'
fake_container_binary = 'podman'
fake_container_image = 'quay.ceph.io/ceph/daemon:latest'
fake_id = '42'
fake_uuid = '0c4a7eca-0c2a-4c12-beff-08a80f064c52'
fake_path = '/etc/ceph/osd/{}-{}... | from mock.mock import patch
import os
import pytest
import ca_test_common
import ceph_volume_simple_activate
fake_cluster = 'ceph'
fake_container_binary = 'podman'
fake_container_image = 'quay.ceph.io/ceph/daemon:latest'
fake_id = '42'
fake_uuid = '0c4a7eca-0c2a-4c12-beff-08a80f064c52'
fake_path = '/etc/ceph/osd/{}-{}... | none | 1 | 1.939609 | 2 | |
setup.py | Minterious/minter-monitoring | 2 | 11867 | import setuptools
setuptools.setup(
name='mintermonitoring',
version='1.0.0',
packages=setuptools.find_packages(include=['mintermonitoring'])
)
| import setuptools
setuptools.setup(
name='mintermonitoring',
version='1.0.0',
packages=setuptools.find_packages(include=['mintermonitoring'])
)
| none | 1 | 1.175962 | 1 | |
Python/Back_solve_python/back_joon/StringArray/P10808.py | skyriv213/Studyriv | 0 | 11868 | <reponame>skyriv213/Studyriv
s = input()
num = [0] * 26
for i in range(len(s)):
num[ord(s[i])-97] += 1
for i in num:
print(i, end = " ")
if i == len(num)-1:
print(i)
| s = input()
num = [0] * 26
for i in range(len(s)):
num[ord(s[i])-97] += 1
for i in num:
print(i, end = " ")
if i == len(num)-1:
print(i) | none | 1 | 3.24936 | 3 | |
src/reliefcpp/utils.py | ferrocactus/reliefcpp | 0 | 11869 | <gh_stars>0
from enum import Enum
from numpy import isin
class Metric(Enum):
EUCLIDEAN = 0
MANHATTAN = 1
HAMMING = 2
L2 = 3
L1 = 4
metric_names = [
"euclidean",
"manhattan",
"hamming",
"l2",
"l1"
]
def _validate_metric(metric_name):
if isinstance(metric_name, Metric):
... | from enum import Enum
from numpy import isin
class Metric(Enum):
EUCLIDEAN = 0
MANHATTAN = 1
HAMMING = 2
L2 = 3
L1 = 4
metric_names = [
"euclidean",
"manhattan",
"hamming",
"l2",
"l1"
]
def _validate_metric(metric_name):
if isinstance(metric_name, Metric):
retu... | none | 1 | 3.427328 | 3 | |
utilityFiles/createValidationDatasetFromXYTrainWithCandidates.py | jmfinelli/JavaNeuralDecompiler | 1 | 11870 | import pandas as pd
import os.path
length_switch = True
max_body_length = 50
process_candidates = os.path.exists('./datasets/candidates.output')
x_train = open('./datasets/x_train').readlines()
x_train = [x.rstrip('\n') for x in x_train]
y_train = open('./datasets/y_train').readlines()
y_train = [x.rstrip('\n') for x... | import pandas as pd
import os.path
length_switch = True
max_body_length = 50
process_candidates = os.path.exists('./datasets/candidates.output')
x_train = open('./datasets/x_train').readlines()
x_train = [x.rstrip('\n') for x in x_train]
y_train = open('./datasets/y_train').readlines()
y_train = [x.rstrip('\n') for x... | en | 0.093278 | # df_valid = df_valid.sample(frac=1).reset_index(drop=True).sample(50000) | 2.371132 | 2 |
py/Utility.GetData.py | mathematicalmichael/SpringNodes | 51 | 11871 | import System
dataKey, _ = IN
OUT = System.AppDomain.CurrentDomain.GetData("_Dyn_Wireless_%s" % dataKey) | import System
dataKey, _ = IN
OUT = System.AppDomain.CurrentDomain.GetData("_Dyn_Wireless_%s" % dataKey) | none | 1 | 1.281195 | 1 | |
codes_/1189_Maximum_Number_of_Balloons.py | SaitoTsutomu/leetcode | 0 | 11872 | <reponame>SaitoTsutomu/leetcode
# %% [1189. *Maximum Number of Balloons](https://leetcode.com/problems/maximum-number-of-balloons/)
# 問題:textから'ballon'を構成できる数を返せ
# 解法:collections.Counterを用いる
class Solution:
def maxNumberOfBalloons(self, text: str) -> int:
c = collections.Counter(text)
return min(c[s... | # %% [1189. *Maximum Number of Balloons](https://leetcode.com/problems/maximum-number-of-balloons/)
# 問題:textから'ballon'を構成できる数を返せ
# 解法:collections.Counterを用いる
class Solution:
def maxNumberOfBalloons(self, text: str) -> int:
c = collections.Counter(text)
return min(c[s] // n for s, n in collections.C... | ja | 0.453988 | # %% [1189. *Maximum Number of Balloons](https://leetcode.com/problems/maximum-number-of-balloons/) # 問題:textから'ballon'を構成できる数を返せ # 解法:collections.Counterを用いる | 3.659685 | 4 |
src/Quiet.X.Tests/i2c_test.py | callwyat/Quiet-Firmware | 0 | 11873 | from quiet_coms import find_quiet_ports
from quiet import Quiet
import time
if 'EXIT_ON_FAIL' not in locals():
VERBOSE = True
EXIT_ON_FAIL = True
class QuietI2C(Quiet):
def __init__(self, coms, **kargs) -> None:
Quiet.__init__(self, coms, **kargs)
def raw_write(self, addr: int, data: bytearra... | from quiet_coms import find_quiet_ports
from quiet import Quiet
import time
if 'EXIT_ON_FAIL' not in locals():
VERBOSE = True
EXIT_ON_FAIL = True
class QuietI2C(Quiet):
def __init__(self, coms, **kargs) -> None:
Quiet.__init__(self, coms, **kargs)
def raw_write(self, addr: int, data: bytearra... | en | 0.44527 | # Clear Errors # Verify the second hook works #11A') #10') #296' + '0123456789ABCDEF' * 6) #13ABC') | 2.403105 | 2 |
WEEKS/CD_Sata-Structures/_RESOURCES/python-prac/Overflow/_Data-Structures/binary-tree/binary-tree-tilt.py | webdevhub42/Lambda | 5 | 11874 | <reponame>webdevhub42/Lambda<gh_stars>1-10
# Source : https://leetcode.com/problems/binary-tree-tilt/description/
# Date : 2017-12-26
# Definition for a binary tree node.
# class TreeNode:
# def __init__(self, x):
# self.val = x
# self.left = None
# self.right = None
class Solution:
... | # Source : https://leetcode.com/problems/binary-tree-tilt/description/
# Date : 2017-12-26
# Definition for a binary tree node.
# class TreeNode:
# def __init__(self, x):
# self.val = x
# self.left = None
# self.right = None
class Solution:
def findTilt(self, root):
"""
... | en | 0.643478 | # Source : https://leetcode.com/problems/binary-tree-tilt/description/ # Date : 2017-12-26 # Definition for a binary tree node. # class TreeNode: # def __init__(self, x): # self.val = x # self.left = None # self.right = None :type root: TreeNode :rtype: int | 3.943143 | 4 |
kerastuner/engine/tuner_utils.py | krantirk/keras-tuner | 1 | 11875 | # Copyright 2019 The Keras Tuner Authors
#
# 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.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to... | # Copyright 2019 The Keras Tuner Authors
#
# 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.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to... | en | 0.841566 | # Copyright 2019 The Keras Tuner Authors # # 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.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to... | 2.089126 | 2 |
plotter.py | ZiegHailo/SMUVI | 0 | 11876 | <reponame>ZiegHailo/SMUVI
__author__ = 'zieghailo'
import matplotlib.pyplot as plt
# plt.ion()
def show():
plt.show()
plt.get_current_fig_manager().full_screen_toggle()
def plot_graph(graph):
# plt.ion()
x = [p.x for p in graph.points]
y = [p.y for p in graph.points]
plt.plot(x, y, 'b*')
... | __author__ = 'zieghailo'
import matplotlib.pyplot as plt
# plt.ion()
def show():
plt.show()
plt.get_current_fig_manager().full_screen_toggle()
def plot_graph(graph):
# plt.ion()
x = [p.x for p in graph.points]
y = [p.y for p in graph.points]
plt.plot(x, y, 'b*')
plt.draw()
def plot_ar... | ru | 0.100472 | # plt.ion() # plt.ion() # ax.arrow(x, y, cx-x, cy-y) # empty line | 3.117355 | 3 |
fannypack/utils/_deprecation.py | brentyi/hfdsajk | 5 | 11877 | import warnings
from typing import Callable, Optional, TypeVar, cast
CallableType = TypeVar("CallableType", bound=Callable)
def deprecation_wrapper(message: str, function_or_class: CallableType) -> CallableType:
"""Creates a wrapper for a deprecated function or class. Prints a warning
the first time a functi... | import warnings
from typing import Callable, Optional, TypeVar, cast
CallableType = TypeVar("CallableType", bound=Callable)
def deprecation_wrapper(message: str, function_or_class: CallableType) -> CallableType:
"""Creates a wrapper for a deprecated function or class. Prints a warning
the first time a functi... | en | 0.61919 | Creates a wrapper for a deprecated function or class. Prints a warning the first time a function or class is called. Args: message (str): Warning message. function_or_class (CallableType): Function or class to wrap. Returns: CallableType: Wrapped function/class. # pragma: no cover ... | 3.180408 | 3 |
write/5_json_writer.py | pavlovprojects/python_qa_test_data | 0 | 11878 | import json
data = {
"users": [
{"Name": "Dominator", "skill": 100, "gold": 99999, "weapons": ['Sword', 'Atomic Laser']},
{"Name": "Looser", "skill": 1, "gold": -100000, "weapons": [None, None, None]},
]
}
with open("example.json", "w") as f:
s = json.dumps(data, indent=4)
f.write(s)
| import json
data = {
"users": [
{"Name": "Dominator", "skill": 100, "gold": 99999, "weapons": ['Sword', 'Atomic Laser']},
{"Name": "Looser", "skill": 1, "gold": -100000, "weapons": [None, None, None]},
]
}
with open("example.json", "w") as f:
s = json.dumps(data, indent=4)
f.write(s)
| none | 1 | 2.773893 | 3 | |
src/utils.py | sequoia-tree/cs370 | 1 | 11879 | <filename>src/utils.py<gh_stars>1-10
from md_utils import *
from py_utils import *
| <filename>src/utils.py<gh_stars>1-10
from md_utils import *
from py_utils import *
| none | 1 | 1.236525 | 1 | |
practice/ai/machine-learning/digital-camera-day-or-night/digital-camera-day-or-night.py | zeyuanxy/HackerRank | 4 | 11880 | <reponame>zeyuanxy/HackerRank
if __name__ == "__main__":
data = raw_input().strip(',\n').split(' ')
count = 0
total = 0
for pxl in data:
pxl = pxl.split(',')
mean = 0
for i in pxl:
mean += int(i)
mean /= 3
if mean < 70:
count += 1
t... | if __name__ == "__main__":
data = raw_input().strip(',\n').split(' ')
count = 0
total = 0
for pxl in data:
pxl = pxl.split(',')
mean = 0
for i in pxl:
mean += int(i)
mean /= 3
if mean < 70:
count += 1
total += 1
if float(count) ... | none | 1 | 3.67959 | 4 | |
Mini Projects/RockPaperScissors/RPS.py | Snowystar122/Python-Projects | 0 | 11881 | import random as r
# Sets up required variables
running = True
user_wins = 0
comp_wins = 0
answers = ["R", "P", "S"]
win_combos = ["PR", "RS", "SP"]
# Welcome message
print("Welcome to Rock-Paper-Scissors. Please input one of the following:"
"\n'R' - rock\n'P' - paper\n'S' - scissors\nto get started.")
whil... | import random as r
# Sets up required variables
running = True
user_wins = 0
comp_wins = 0
answers = ["R", "P", "S"]
win_combos = ["PR", "RS", "SP"]
# Welcome message
print("Welcome to Rock-Paper-Scissors. Please input one of the following:"
"\n'R' - rock\n'P' - paper\n'S' - scissors\nto get started.")
whil... | en | 0.88189 | # Sets up required variables # Welcome message # Running game of rock, paper, scissors # Checks to see if computer or user has won the round. | 4.099648 | 4 |
pybullet-gym/pybulletgym/agents/agents_baselines.py | SmaleZ/vcl_diayn | 2 | 11882 | from baselines import deepq
def add_opts(parser):
pass
class BaselinesDQNAgent(object):
'''
classdocs
'''
def __init__(self, opts):
self.metadata = {
'discrete_actions': True,
}
self.opts = opts
self.agent = None
def configure(self, observation_space_shape, nb_actions):
pass
def train(self, ... | from baselines import deepq
def add_opts(parser):
pass
class BaselinesDQNAgent(object):
'''
classdocs
'''
def __init__(self, opts):
self.metadata = {
'discrete_actions': True,
}
self.opts = opts
self.agent = None
def configure(self, observation_space_shape, nb_actions):
pass
def train(self, ... | none | 1 | 2.339288 | 2 | |
exploit.py | hexcowboy/CVE-2020-8813 | 0 | 11883 | #!/usr/bin/python3
import requests
import click
from rich import inspect
from rich.console import Console
from url_normalize import url_normalize
from urllib.parse import quote
console = Console()
def shell_encode(string):
return string.replace(" ", "${IFS}")
@click.command()
@click.option("-u", "--url", prompt... | #!/usr/bin/python3
import requests
import click
from rich import inspect
from rich.console import Console
from url_normalize import url_normalize
from urllib.parse import quote
console = Console()
def shell_encode(string):
return string.replace(" ", "${IFS}")
@click.command()
@click.option("-u", "--url", prompt... | en | 0.441847 | #!/usr/bin/python3 Cacti v1.2.8 Unauthenticated Remote Code Execution # Normalize URL input, URL encode the payload # Check if target is vulnerable | 2.726077 | 3 |
common/src/stack/command/stack/commands/set/firmware/model/imp/__init__.py | kmcm0/stacki | 123 | 11884 | # @copyright@
# Copyright (c) 2006 - 2019 Teradata
# All rights reserved. Stacki(r) v5.x stacki.com
# https://github.com/Teradata/stacki/blob/master/LICENSE.txt
# @copyright@
#
# @rocks@
# Copyright (c) 2000 - 2010 The Regents of the University of California
# All rights reserved. Rocks(r) v5.4 www.rocksclusters.org
# ... | # @copyright@
# Copyright (c) 2006 - 2019 Teradata
# All rights reserved. Stacki(r) v5.x stacki.com
# https://github.com/Teradata/stacki/blob/master/LICENSE.txt
# @copyright@
#
# @rocks@
# Copyright (c) 2000 - 2010 The Regents of the University of California
# All rights reserved. Rocks(r) v5.4 www.rocksclusters.org
# ... | en | 0.639909 | # @copyright@ # Copyright (c) 2006 - 2019 Teradata # All rights reserved. Stacki(r) v5.x stacki.com # https://github.com/Teradata/stacki/blob/master/LICENSE.txt # @copyright@ # # @rocks@ # Copyright (c) 2000 - 2010 The Regents of the University of California # All rights reserved. Rocks(r) v5.4 www.rocksclusters.org # ... | 2.1733 | 2 |
torch/jit/_fuser.py | ljhOfGithub/pytorch | 1 | 11885 | <reponame>ljhOfGithub/pytorch
import contextlib
import torch
from typing import List, Tuple
@contextlib.contextmanager
def optimized_execution(should_optimize):
"""
A context manager that controls whether the JIT's executor will run
optimizations before executing a function.
"""
stored_flag = torc... | import contextlib
import torch
from typing import List, Tuple
@contextlib.contextmanager
def optimized_execution(should_optimize):
"""
A context manager that controls whether the JIT's executor will run
optimizations before executing a function.
"""
stored_flag = torch._C._get_graph_executor_optim... | en | 0.878654 | A context manager that controls whether the JIT's executor will run optimizations before executing a function. A context manager that facilitates switching between backend fusers. Valid names: * ``fuser0`` - enables only legacy fuser * ``fuser1`` - enables only NNC * ``fuser2`` - enables only n... | 2.185811 | 2 |
modlit/db/postgres.py | patdaburu/modlit | 0 | 11886 | <reponame>patdaburu/modlit<filename>modlit/db/postgres.py<gh_stars>0
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Created by pat on 5/8/18
"""
.. currentmodule:: modlit.db.postgres
.. moduleauthor:: <NAME> <<EMAIL>>
This module contains utilities for working directly with PostgreSQL.
"""
import json
from pathlib i... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# Created by pat on 5/8/18
"""
.. currentmodule:: modlit.db.postgres
.. moduleauthor:: <NAME> <<EMAIL>>
This module contains utilities for working directly with PostgreSQL.
"""
import json
from pathlib import Path
from urllib.parse import urlparse, ParseResult
from addict... | en | 0.646058 | #!/usr/bin/env python # -*- coding: utf-8 -*- # Created by pat on 5/8/18 .. currentmodule:: modlit.db.postgres .. moduleauthor:: <NAME> <<EMAIL>> This module contains utilities for working directly with PostgreSQL. #: the default administrative database name #: the default PostgreSQL listener port # Load the Postgres ... | 2.88043 | 3 |
estradaspt_legacy/__init__.py | dpjrodrigues/home-assistant-custom-components | 0 | 11887 | import logging
import async_timeout
import urllib.request
import time
import re
from datetime import datetime, timedelta
import voluptuous as vol
import homeassistant.helpers.config_validation as cv
from homeassistant.components.sensor import PLATFORM_SCHEMA
from homeassistant.helpers.entity import Entity
from homea... | import logging
import async_timeout
import urllib.request
import time
import re
from datetime import datetime, timedelta
import voluptuous as vol
import homeassistant.helpers.config_validation as cv
from homeassistant.components.sensor import PLATFORM_SCHEMA
from homeassistant.helpers.entity import Entity
from homea... | en | 0.831336 | Set up the Camera component Save camera 3gp Sensor that reads and stores the camera video. Initialize the component. Return the name of the component. Return the file_name where camara was saved. Return the url of the camera. Return the date when camera url refreshed. Icon to use in the frontend, if any. Return other d... | 2.067141 | 2 |
parser.py | boshijingang/PyLuaCompiler | 0 | 11888 | <filename>parser.py<gh_stars>0
import lexer
import ast
class Parser:
block_end_tokens = [lexer.TokenKind.KW_RETURN, lexer.TokenKind.EOF,
lexer.TokenKind.KW_END, lexer.TokenKind.KW_ELSE,
lexer.TokenKind.KW_ELSEIF, lexer.TokenKind.KW_UNTIL]
priority_table = {
... | <filename>parser.py<gh_stars>0
import lexer
import ast
class Parser:
block_end_tokens = [lexer.TokenKind.KW_RETURN, lexer.TokenKind.EOF,
lexer.TokenKind.KW_END, lexer.TokenKind.KW_ELSE,
lexer.TokenKind.KW_ELSEIF, lexer.TokenKind.KW_UNTIL]
priority_table = {
... | en | 0.455323 | # + # - # * # % # / # // # ^ # & # | # ~ # << # >> # .. # == # <= # < # ~= # > # >= # and # or # explist ::= exp {‘,’ exp} # exp ::= (simpleexp | unop exp) {binop exp} # args ::= ‘(’ [explist] ‘)’ | tableconstructor | LiteralString # tableconstructor ::= ‘{’ [fieldlist] ‘}’ # simpleexp ::= nil | false | true | Numeral... | 2.442171 | 2 |
python/terra_proto/terra/treasury/v1beta1/__init__.py | Vritra4/terra.proto | 0 | 11889 | # Generated by the protocol buffer compiler. DO NOT EDIT!
# sources: terra/treasury/v1beta1/genesis.proto, terra/treasury/v1beta1/query.proto, terra/treasury/v1beta1/treasury.proto
# plugin: python-betterproto
from dataclasses import dataclass
from typing import Dict, List
import betterproto
from betterproto.grpc.grp... | # Generated by the protocol buffer compiler. DO NOT EDIT!
# sources: terra/treasury/v1beta1/genesis.proto, terra/treasury/v1beta1/query.proto, terra/treasury/v1beta1/treasury.proto
# plugin: python-betterproto
from dataclasses import dataclass
from typing import Dict, List
import betterproto
from betterproto.grpc.grp... | en | 0.721975 | # Generated by the protocol buffer compiler. DO NOT EDIT! # sources: terra/treasury/v1beta1/genesis.proto, terra/treasury/v1beta1/query.proto, terra/treasury/v1beta1/treasury.proto # plugin: python-betterproto Params defines the parameters for the oracle module. PolicyConstraints - defines policy constraints can be ap... | 1.606725 | 2 |
usbservo/usbservogui.py | ppfenninger/screwball | 0 | 11890 | <reponame>ppfenninger/screwball
#
## Copyright (c) 2018, <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:
##
## 1. Redistributions of source code must retain the above copyr... | #
## Copyright (c) 2018, <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:
##
## 1. Redistributions of source code must retain the above copyright
## notice, this li... | en | 0.619948 | # ## Copyright (c) 2018, <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: ## ## 1. Redistributions of source code must retain the above copyright ## notice, this list of condi... | 1.849897 | 2 |
GasBotty/models/utils.py | GreenCUBIC/GasBotty | 353 | 11891 | <reponame>GreenCUBIC/GasBotty
try:
from torch.hub import load_state_dict_from_url
except ImportError:
from torch.utils.model_zoo import load_url as load_state_dict_from_url
| try:
from torch.hub import load_state_dict_from_url
except ImportError:
from torch.utils.model_zoo import load_url as load_state_dict_from_url | none | 1 | 1.572634 | 2 | |
pyzayo/svcinv_mixin.py | jeremyschulman/pyzayo | 1 | 11892 | <filename>pyzayo/svcinv_mixin.py
"""
This file contains the Zayo Service Inventory related API endpoints.
References
----------
Docs
http://172.16.17.32/wp-content/uploads/2020/02/Service-Inventory-Wiki.pdf
"""
# -----------------------------------------------------------------------------
# System Imports
# ... | <filename>pyzayo/svcinv_mixin.py
"""
This file contains the Zayo Service Inventory related API endpoints.
References
----------
Docs
http://172.16.17.32/wp-content/uploads/2020/02/Service-Inventory-Wiki.pdf
"""
# -----------------------------------------------------------------------------
# System Imports
# ... | en | 0.408655 | This file contains the Zayo Service Inventory related API endpoints. References ---------- Docs http://172.16.17.32/wp-content/uploads/2020/02/Service-Inventory-Wiki.pdf # ----------------------------------------------------------------------------- # System Imports # ------------------------------------------... | 1.444204 | 1 |
pychron/core/helpers/logger_setup.py | aelamspychron/pychron | 1 | 11893 | <reponame>aelamspychron/pychron<gh_stars>1-10
# ===============================================================================
# Copyright 2011 <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 Li... | # ===============================================================================
# Copyright 2011 <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... | en | 0.669231 | # =============================================================================== # Copyright 2011 <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.895486 | 2 |
picmodels/models/care_advisors/case_management_models/sequence_models/services/create_update_delete.py | bbcawodu/careadvisors-backend | 0 | 11894 | <filename>picmodels/models/care_advisors/case_management_models/sequence_models/services/create_update_delete.py
import picmodels
def create_row_w_validated_params(cls, validated_params, rqst_errors):
if 'name' not in validated_params:
rqst_errors.append("'name' is a required key in the validated_params a... | <filename>picmodels/models/care_advisors/case_management_models/sequence_models/services/create_update_delete.py
import picmodels
def create_row_w_validated_params(cls, validated_params, rqst_errors):
if 'name' not in validated_params:
rqst_errors.append("'name' is a required key in the validated_params a... | none | 1 | 2.112277 | 2 | |
elegy/optimizer_test.py | sooheon/elegy | 0 | 11895 | import jax
import elegy
import unittest
import numpy as np
import jax.numpy as jnp
import optax
class MLP(elegy.Module):
"""Standard LeNet-300-100 MLP network."""
n1: int
n2: int
def __init__(self, n1: int = 3, n2: int = 4):
super().__init__()
self.n1 = n1
self.n2 = n2
... | import jax
import elegy
import unittest
import numpy as np
import jax.numpy as jnp
import optax
class MLP(elegy.Module):
"""Standard LeNet-300-100 MLP network."""
n1: int
n2: int
def __init__(self, n1: int = 3, n2: int = 4):
super().__init__()
self.n1 = n1
self.n2 = n2
... | en | 0.560037 | Standard LeNet-300-100 MLP network. | 2.482963 | 2 |
scripts/version.py | nfnty/docker | 54 | 11896 | <filename>scripts/version.py
#!/usr/bin/python3
''' Check image package versions '''
import argparse
import distutils.version
import re
import subprocess
from typing import Any, Dict, Sequence, Tuple
import lxml.html # type: ignore
import requests
from termcolor import cprint
from utils.image import IMAGES, path_do... | <filename>scripts/version.py
#!/usr/bin/python3
''' Check image package versions '''
import argparse
import distutils.version
import re
import subprocess
from typing import Any, Dict, Sequence, Tuple
import lxml.html # type: ignore
import requests
from termcolor import cprint
from utils.image import IMAGES, path_do... | en | 0.609708 | #!/usr/bin/python3 Check image package versions # type: ignore # (Connect, Read) Parse arguments Fetch URL xpath version extractor # pylint: disable=no-member Scrape latest version from url Return dict with repository versions of package Update Dockerfiles with current version # pylint: disable=too-many-branches Main | 2.417331 | 2 |
nazrul.py | rakesh0703/Content_Parser_of_works_of_kazi_nazrul | 0 | 11897 | # -- coding: UTF-8 --
"""
Spyder Editor
This is a temporary script file.
"""
from bs4 import BeautifulSoup
import sys
import os
import ssl
ssl._create_default_https_context = ssl._create_unverified_context
import urllib.parse,urllib.request,urllib.error
base="https://nazrul-rachanabali.nltr.org/"
page=urllib.request.... | # -- coding: UTF-8 --
"""
Spyder Editor
This is a temporary script file.
"""
from bs4 import BeautifulSoup
import sys
import os
import ssl
ssl._create_default_https_context = ssl._create_unverified_context
import urllib.parse,urllib.request,urllib.error
base="https://nazrul-rachanabali.nltr.org/"
page=urllib.request.... | en | 0.276594 | # -- coding: UTF-8 -- Spyder Editor This is a temporary script file. #print(ba) #type(d[3]) #soup.div.ul.li.a #for k in arr2: #============================================================================== # page1=urllib.request.urlopen(final_url).read() # soup1=BeautifulSoup(page1,'html5lib') # head = soup1.... | 2.813922 | 3 |
algoplex/api/order.py | dmitryaleks/algo-plex | 0 | 11898 | <reponame>dmitryaleks/algo-plex
class Order():
def __init__(self, side, pair, size, price, stop_loss_price, id):
self.side = side
self.pair = pair
self.size = size
self.price = price
self.stop_loss_price = stop_loss_price
self.id = id
self.fills = []
def... | class Order():
def __init__(self, side, pair, size, price, stop_loss_price, id):
self.side = side
self.pair = pair
self.size = size
self.price = price
self.stop_loss_price = stop_loss_price
self.id = id
self.fills = []
def define_id(self, id):
se... | none | 1 | 3.124295 | 3 | |
core/handler.py | mh4x0f/kinproxy | 5 | 11899 | try:
from mitmproxy import controller, proxy
from mitmproxy.proxy.server import ProxyServer
except:
from libmproxy import controller, proxy
from libmproxy.proxy.server import ProxyServer
from plugins import *
from threading import Thread
from core.config.settings import SettingsINI
# MIT License
#
# Co... | try:
from mitmproxy import controller, proxy
from mitmproxy.proxy.server import ProxyServer
except:
from libmproxy import controller, proxy
from libmproxy.proxy.server import ProxyServer
from plugins import *
from threading import Thread
from core.config.settings import SettingsINI
# MIT License
#
# Co... | en | 0.695057 | # MIT License # # Copyright (c) 2018 <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, copy, modify, merge, publi... | 1.879836 | 2 |