blob_id stringlengths 40 40 | language stringclasses 1
value | repo_name stringlengths 5 133 | path stringlengths 2 333 | src_encoding stringclasses 30
values | length_bytes int64 18 5.47M | score float64 2.52 5.81 | int_score int64 3 5 | detected_licenses listlengths 0 67 | license_type stringclasses 2
values | text stringlengths 12 5.47M | download_success bool 1
class |
|---|---|---|---|---|---|---|---|---|---|---|---|
a337cd7e52086c9133fd71dcc92cc8a02615f7e7 | Python | shenely/ouroboros | /ob-math/ob-math/vec.py | UTF-8 | 10,513 | 2.75 | 3 | [] | no_license | # built-in libraries
import math
import itertools
# external libraries
import numpy
import scipy.linalg
# internal libraries
from ouroboros import Type, Image, Node
# exports
__all__= ("vector",
"abs2rel", "rel2abs", # absolute <-> relative frame
"nrt2rot", "rot2nrt", # inertial <-> rotating fr... | true |
01244cdce59919aaa9e3cd68beda3487cb6f4d28 | Python | yauhenhapan/python-labs | /Lab3/many_random_walk_ans.py | UTF-8 | 1,390 | 3.828125 | 4 | [] | no_license | import numpy as np
def random_walks(walks_count):
walks = []
number_of_steps = 1500
for i in range(walks_count):
draws = np.random.randint(0, 2, size=number_of_steps)
steps = np.where(draws > 0, 1, -1)
walk = steps.cumsum()
walks.append(walk)
return walks
def find_min... | true |
35af26db2f15bb57c7944525054a5408a1effc99 | Python | kumar-shubham/wisecells-library | /library/forms.py | UTF-8 | 986 | 2.578125 | 3 | [] | no_license | from django import forms
from library.models import Books
from django.core.validators import validate_email
class AddBookForm(forms.Form):
book_id = forms.IntegerField()
book_name = forms.CharField(max_length=50)
count = forms.IntegerField()
author = forms.CharField(max_length=50)
def clean_book_name(self):
b... | true |
884c3ba8b6e61142818518e76891c95ca7af9eea | Python | madclumsil33t/atat | /atat/utils/session_limiter.py | UTF-8 | 650 | 2.546875 | 3 | [
"MIT"
] | permissive | from atat.domain.users import Users
class SessionLimiter(object):
def __init__(self, config, session, redis):
self.limit_logins = config["LIMIT_CONCURRENT_SESSIONS"]
self.session_prefix = config.get("SESSION_KEY_PREFIX", "session:")
self.session = session
self.redis = redis
de... | true |
f1a1e3fe0d1efe29838093be6173c483fac1e0c0 | Python | exxxar/python | /оценки и лабы других/бурцев/lab1/lab1/7.py | WINDOWS-1251 | 318 | 3.203125 | 3 | [] | no_license | # -*- coding: cp1251 -*-
try:
karta=raw_input(' 16 ')
if len(karta)!=16:
raise ValueError(' . 16 ')
print karta[0:4]+"*"*8+karta[12:16]
except ValueError,e:
print e
| true |
d2a74914a2ac20e34eb5f4c72edbc4d23af71438 | Python | kamyu104/GoogleCodeJam-2016 | /Round 1A/the-last-word.py | UTF-8 | 684 | 3.5 | 4 | [
"MIT"
] | permissive | # Copyright (c) 2016 kamyu. All rights reserved.
#
# Google Code Jam 2016 Round 1A - Problem A. The Last Word
# https://code.google.com/codejam/contest/4304486/dashboard#s=p0
#
# Time: O(L), L is the length of S
# Space: O(L)
#
from collections import deque
def the_last_word():
S = raw_input().strip()
word =... | true |
31c3018f23e4e467a1f3f57c54c11df80b3d963f | Python | MMMdata/BigQuery_auto_reporting | /load_data_from_csv.py | UTF-8 | 4,072 | 2.5625 | 3 | [] | no_license | #!/usr/bin/env python
# Copyright 2015, Google, Inc.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ... | true |
ce2c4314a20addda5ae8fa672b699e822734b108 | Python | tolgakurtulus/Python-First-Little-Project | /degiskenler.py | UTF-8 | 222 | 3.03125 | 3 | [] | no_license | sayi = 10 # integer
tc = "10101010108" #string
isim = "engin"
soyisim = "demiroğ"
telefonNumarasi = "5354444444"
floatSayi = 10.0
print(float(tc) + 10)
print(type(floatSayi))
print(type(sayi))
print(type(tc))
| true |
3d2712bd8595bf86fa15998015e6cbbe6e7e63c0 | Python | vbehrens/Lab1 | /largest_num.py | UTF-8 | 250 | 3.25 | 3 | [] | no_license | lugage = int(raw_input("How much doues you lugage weigh, prompt enter a number"))
print type(lugage)
def weigh (lugage):
if lugage > 50:
print "There is a $25 charge for your suitcase"
else:
print "no charge"
weigh (lugage)
| true |
126025d90b455acd01941034a7a0c28f2b4ae22c | Python | jhassler1031/sports-api | /sports_api.py | UTF-8 | 1,399 | 2.953125 | 3 | [] | no_license | import records
from flask import Flask, jsonify
app = Flask(__name__)
db = records.Database("postgres://localhost/sports_db")
#first part of homework
@app.route("/first")
def show_html():
return "<div>Hello world!</div>"
#updated to output JSON instead of HTML
@app.route("/second")
def show_json():
list = [1,... | true |
df2ab86fc34f65d8a9d72d9f3d849baa7efd0029 | Python | janvonrickenbach/Chaco_wxPhoenix_py3 | /chaco/scales/tests/test_time_scale.py | UTF-8 | 15,784 | 2.875 | 3 | [
"BSD-3-Clause",
"LicenseRef-scancode-unknown-license-reference",
"LicenseRef-scancode-public-domain"
] | permissive | import datetime
import os
import contextlib
import numpy as np
from chaco.scales.time_scale import (tfrac, trange, TimeScale,
CalendarScaleSystem)
from chaco.scales.api import TimeFormatter
# Note on testing:
# Chaco assumes times are in UTC seconds since Posix Epoch b... | true |
1b2bb5e026a2d48d6c98d6282aa6f43468c9e418 | Python | Harvnlenny/demo | /demo/features/steps/players.py | UTF-8 | 583 | 3.03125 | 3 | [] | no_license | from behave import given, when, then
from hamcrest import assert_that, equal_to, contains_string
from pages.home.home_page import HomePage
@when('a name is typed into the search field')
def player(context):
player_name = "Bernie Kosar"
hp = HomePage(context.driver)
hp.player_search(player_name)
@then('the... | true |
e2a89949b2eaee7affb98f1c34aa5b3f9a4713e9 | Python | happyhappyhappyhappy/pythoncode | /atcoder/mizuiro/bitzentansaku/s8pc4b_build_color/second/submit2.py | UTF-8 | 1,315 | 2.75 | 3 | [] | no_license | # ライブラリのインポート
import sys
import pprint as pp
from collections import Counter
from itertools import product
from logging import getLogger, StreamHandler, DEBUG
# 入力のマクロ
def II(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def LI(): return list(map(int, sys.stdin.r... | true |
e70627cd11fbf5124d1502b37d616c0e64295f10 | Python | facebookresearch/Kats | /kats/detectors/multivariate_detector.py | UTF-8 | 7,033 | 2.734375 | 3 | [
"MIT"
] | permissive | # Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
"""
This module implements the multivariate Outlier Detection algorithm as a Detector Model.
"""
import json
from typing import Any, Option... | true |
2b3dfc91f5349affaeccf18afd4ced315045de4e | Python | DadzieAma/MyFiles | /leap.py | UTF-8 | 431 | 4.40625 | 4 | [] | no_license | def get_age():
age = int(input("Enter the year you were born: "))
if(age%4) == 0:
if(age%100) == 0:
if(age%400) == 0:
print("{0} is a leap year".format(age))
else:
print("{0} is not a leap year".format(age))
else:
print("{0... | true |
66d77302a9013e262d43b9195ba2500b4f27ff76 | Python | AlthafHussainK/python_lab | /structs1.py | UTF-8 | 328 | 3.5 | 4 | [] | no_license | import csv
from student import Student
students = []
for i in range(3):
name = input("name: ")
place = input("place: ")
students.append(Student(name, place))
file = open("students.csv", "w")
writer = csv.writer(file)
for student in students:
writer.writerow((student.name, student.place))
file.close... | true |
29754ee163d31e5646ca85cb3cf6175b1734ab79 | Python | ksenyavasina/Cell-Phones-and-Accessories- | /word analysis.py | UTF-8 | 1,241 | 2.96875 | 3 | [] | no_license | import pandas as pd
from sklearn.feature_extraction.text import CountVectorizer
from sklearn.feature_extraction.text import TfidfVectorizer
from sklearn.linear_model import LogisticRegression
from sklearn.model_selection import train_test_split
data = pd.read_csv('data.csv', delimiter=',')
df = data[data['review/score... | true |
637b58f67780dc7d8d1fc392855280c36472b8f3 | Python | mattEhall/FrequencyDomain | /FrequencyDomain.py | UTF-8 | 61,182 | 2.78125 | 3 | [] | no_license | # 2020-05-03: This is a start at a frequency-domain floating support structure model for WEIS-WISDEM.
# Based heavily on the GA-based optimization framework from Hall 2013
# 2020-05-23: Starting as a script that will evaluate a design based on properties/data provided in separate files.
import numpy as n... | true |
25cbf73fe84ed295402f5aacba217d3ad676d4a7 | Python | themellion/feecalculator | /feecalculator.py | UTF-8 | 1,732 | 3.171875 | 3 | [] | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Fri Feb 15 07:00:17 2019
@author: themellion
"""
import numpy as np
import pandas as pd
#initialise the fee structure
term12 = [50, 90, 90, 115, 100, 120, 140, 160, 180, 200, 220, 240, 260, 280, 300, 320, 340, 360, 380, 400]
term24 = [70, 100, 120, 16... | true |
210aeac78e3e6bd11a10e58d6bc1a8d86a2c30fe | Python | ReshmaRajanChinchu/python-programming | /python29.py | UTF-8 | 135 | 3.328125 | 3 | [] | no_license | a=int(input("enter the time"))
s=0
if(a<=60):
print(str(s)+":"+ str(a))
else:
c=a//60
d=a%60
print(str(c)+":"+str(d))
| true |
efffd1a5f8a968cedb6ca5cfbde48170962a0f70 | Python | neizod/problems | /acm/uva/623-500factorial.py | UTF-8 | 264 | 3.21875 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python3
from math import factorial
def main():
try:
while True:
n = int(input())
print('{}!'.format(n))
print(factorial(n))
except EOFError:
pass
if __name__ == '__main__':
main()
| true |
1235262f0f8c742479aeb437efd965c1f3bd326c | Python | hcsullivan12/pixsim | /python/pixsim/velocity.py | UTF-8 | 1,487 | 2.90625 | 3 | [] | no_license | #!/usr/bin/env python
'''
Electron drift functionality.
'''
import math
import numpy
from collections import namedtuple
def mobility_function(Emag, temperature = 89):
'''
Return the mobility for the given magnitude of the
electric field and temperature. Units need to be kV, cm.
'''
Trel = temper... | true |
441eedb34d9ec28a5fe03a4e1198d22f0f04b360 | Python | nestoop/base-python | /base/ai/LineRegression-Lasso.py | UTF-8 | 4,153 | 2.953125 | 3 | [] | no_license | #!/usr/bin/python
import numpy as np
from sklearn.linear_model import LinearRegression
from sklearn.linear_model import Lasso
from sklearn.linear_model import Ridge
from sklearn.datasets import load_boston
from sklearn.model_selection import train_test_split
import matplotlib.pyplot as plt
X_boson, y_boson = load_bos... | true |
3adfe4e6b8b5a375c06989652aff3abdd9b7d376 | Python | jlovering/AdventOfCode2020 | /Day16/day16-1.py | UTF-8 | 2,209 | 3.015625 | 3 | [] | no_license | #!/bin/python
import sys
import copy
import re
infile = open(sys.argv[1], "r")
class Validator:
def __init__(self, name):
self.name = name
self.ranges = []
def addRule(self, minV, maxV):
self.ranges.append((minV,maxV))
def checkAllRanges(self, value):
for r in self.range... | true |
5c1aa93123f3575da75f3c919e927d4df85b7347 | Python | ricardomokhtari/ML-Models | /Clustering/hierarchical_clustering.py | UTF-8 | 1,511 | 3.78125 | 4 | [] | no_license | """
Implemetation of Hierarchical clustering algorithm for 2 independent variables:
- Annual income
- Spending score
Optimal cluster number is identified through examining dendrogram
"""
# import libraries
import pandas as pd
import matplotlib.pyplot as plt
# import the dataset
dataset = pd.read_c... | true |
bb00f7bb43276868f69ebce79b8bf63682781beb | Python | 0xchamin/Machine-Learning-Python | /Fundamentals/python_sandbox_finished/functions.py | UTF-8 | 769 | 5.125 | 5 | [] | no_license | # A function is a block of code which only runs when it is called. In Python, we do not use parentheses and curly brackets, we use indentation with tabs or spaces
# Create function
def sayHello(name = 'Sam'):
"""
Prints Hello and then name.
"""
print('Hello ' + name)
# Return value
def getSum(num1, num2):
t... | true |
df29db0768db2eba89643c9aeb454032f38871ac | Python | TonsOfBricks/projects | /arrows.py | UTF-8 | 3,678 | 3.859375 | 4 | [] | no_license | """
Author: Nikita Sinkha
File: arroes.py
Date:3/2/2018
"""
import turtle as t
import random as r
import math as m
def border():
"""
func: border()
Draws a border of size 500x500.
"""
t.pencolor("blue")
t.forward(500)
t.left(90)
t.forward(500)
t... | true |
339ccd4d5e13b88ad7de380d93130e9ebef34876 | Python | Dragon-Dane/project-azua | /azua/models/bnn/nn/nets.py | UTF-8 | 2,986 | 2.71875 | 3 | [
"MIT",
"LicenseRef-scancode-generic-cla"
] | permissive | from typing import List, Union
import torch.nn as nn
import torchvision
def make_network(architecture: str, *args, **kwargs):
if architecture == "fcn":
return FCN(**kwargs)
elif architecture == "cnn":
return CNN(**kwargs)
elif architecture.startswith("resnet"):
net = getattr(torc... | true |
11a3dd606c22cfce37a4c6274ea4c2ec4b0749e9 | Python | langokalla/TTM4100-2017 | /CHAT_CLIENT/MessageParser.py | UTF-8 | 1,676 | 3.296875 | 3 | [] | no_license | import json
class MessageParser():
def __init__(self, client):
self.possible_responses = {
'error': self.parse_error,
'info': self.parse_info,
'message': self.parse_message,
'history': self.parse_history,
'names': self.parse_names
}
... | true |
5051a70b36c2be5ac4693e3ae6aab6ab32d869e8 | Python | sprithiv/Algorithm-Design | /largest_independent_set.py | UTF-8 | 2,387 | 3.4375 | 3 | [] | no_license | import random
import time
def find_largest_independent_set(matrix):
n = len(matrix)
#create adjacency list from given matrix
edges = {}
for i in range(0,n):
conn_node = []
for j in range(0,n):
if matrix[i][j] != 0:
conn_node.append(j+1)... | true |
eb8086082a7f5f74df5d5acc28d5eac15e25e60a | Python | chaynika/smlAir | /correlation.py | UTF-8 | 364 | 2.796875 | 3 | [] | no_license | # DO NOT RUN, IT RUNS ON final_table.csv SIZE = 1.12 GB. final_table.csv is stored locally on Sarthak's system
# Opens final_table.csv and creates correlation csv wrt destination country
import pandas as pd
df = pd.read_csv('final_table.csv')
a = (df[df.columns[2:1318]].apply(lambda x: x.corr(df['country_destination'... | true |
bb7aa5cc3fbddea15d8c7163234c12999cf30bbb | Python | JavierChames/hanoi_tower_python | /test_hanoi.py | UTF-8 | 403 | 2.53125 | 3 | [] | no_license | import hanoy
file=open("test3.txt")
def test_check_disk_content():
result=hanoy.check_disk_content(file)
assert result == [[[1, 2, 3], [], []],hanoy.number_of_disk,[1, 2, 3]]
def test_moves_content():
result=hanoy.moves
assert result == [13, 12, 32, 13, 21, 23, 13]
def test_c... | true |
ce7a6ce66726ed06309d86bfbcf32ebc15174363 | Python | noticeable/ExtensionOPs | /nms/test_OBB_nms_gpu.py | UTF-8 | 2,519 | 2.5625 | 3 | [] | no_license | import numpy as np
import torch
import cv2
import math
from OBB_NMS_GPU.r_nms import r_nms
def get_rotated_coors(box):
assert len(box) > 0 , 'Input valid box!'
cx = box[0]; cy = box[1]; w = box[2]; h = box[3]; a = box[4]
xmin = cx - w*0.5; xmax = cx + w*0.5; ymin = cy - h*0.5; ymax = cy + h*0.5
t_x0=... | true |
b61a4d693cfb1c7721ed97105f126968f4805892 | Python | mingen-pan/Scraping-H1B-visa-info | /example.py | UTF-8 | 439 | 2.703125 | 3 | [
"MIT"
] | permissive | ### For details, please read the "README" file.
### For details, please read the "README" file.
### For details, please read the "README" file.
from h1b_scraper import H1B_Scraper
scraper = H1B_Scraper()
years = [year for year in range(2017, 2019)]
jobs = ["Software Engineer", "Data Scientist"]
tables = scraper.scrap... | true |
6cef56606376e523a9406aea9b5b9c9daca1be83 | Python | bdelliott/eprofile | /eprofile/fixtures.py | UTF-8 | 746 | 2.96875 | 3 | [] | no_license | """ Misc test code to profile. """
import time
from eventlet import greenthread
from eventlet import greenpool
def foo(i):
bar()
return i
def bar():
time.sleep(0.0) # force a greenthread swap
def multi(n=2):
n = int(n)
# Run in multiple greenthreads
pool = greenpool.GreenPool(n)
re... | true |
f9caa91c24f13a66d52f53189055660ad63f4898 | Python | jun-yoshiyoshi/python_plactice100 | /p33.py | UTF-8 | 405 | 4.15625 | 4 | [] | no_license | # list関数 set関数 &
l1 = ['Python', 'Ruby', 'PHP', 'JavaScript']
l2 = ['Java', 'Ruby', 'Golang', 'Python', 'TypeScript']
new_l = []
for word1 in l1:
for word2 in l2:
if word1 == word2 and word1 not in new_l:
new_l.append(word1)
print(f'共通する値を格納したリスト : {new_l}')
L = list(set(l1) & set(l2))
print... | true |
73dfedf30ca00ebb1b48b4db9011e0b463a9a654 | Python | indraastra/ita-puzzles | /src/bitvector/bitvector.py | UTF-8 | 1,889 | 3.0625 | 3 | [] | no_license | import util
class BitVector:
NUM_BITS = 500
COUNTER = 0
P_FLIP = 0.2
P_SAME = 1 - P_FLIP
def __init__( self, genome, parent=None, children=set() ):
self.COUNTER += 1
self.num_bits = len( genome )
self.id = self.COUNTER
self.genome = genome
self.parent = pa... | true |
c86eb588677455eef673bf1fbeef786e6235e420 | Python | SherbyRobotics/pyro | /examples/demos_by_system/drone/planar_drone_with_lqr.py | UTF-8 | 912 | 2.546875 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Sun Oct 3 08:27:06 2021
@author: alex
"""
import numpy as np
from pyro.dynamic.drone import Drone2D
from pyro.analysis.costfunction import QuadraticCostFunction
from pyro.dynamic.statespace import linearize
from pyro.control.lqr impo... | true |
abe71a7a949aba7e465b92eeb137b33539563780 | Python | rasmussn/UO-2015-PHYS-410-510 | /week_7/simple_xy_wr.py | UTF-8 | 1,727 | 3.609375 | 4 | [] | no_license | # the Scientific Python netCDF 3 interface
# http://dirac.cnrs-orleans.fr/ScientificPython/
# from Scientific.IO.NetCDF import NetCDFFile as Dataset
# the 'classic' version of the netCDF4 python interface
# http://code.google.com/p/netcdf4-python/
#from netCDF4_classic import Dataset
from netCDF4 import Dataset
from nu... | true |
10ea19cc332bf1ee47ca21a68791458eaf68c09f | Python | feature-engine/feature_engine | /tests/test_encoding/test_helper_functions.py | UTF-8 | 815 | 2.953125 | 3 | [
"BSD-3-Clause"
] | permissive | import pytest
from feature_engine.encoding._helper_functions import check_parameter_unseen
@pytest.mark.parametrize("accepted", ["one", False, [1, 2], ("one", "two"), 1])
def test_raises_error_when_accepted_values_not_permitted(accepted):
with pytest.raises(ValueError) as record:
check_parameter_unseen("... | true |
29ca7760e6c78fb8651a5eaa87728a215fcda517 | Python | ojhermann-ucd/comp47600 | /16203034_hermannOtto_practical5/q2/b.py | UTF-8 | 1,158 | 3.015625 | 3 | [] | no_license | # imports
import math
import td_idf
import a
if __name__ == '__main__':
# Documents
document_1 = "I like the talking heads."
document_2 = "I love the talking heads."
document_3 = "I enjoy the talking heads."
document_4 = "I really like the talking heads."
document_5 = "I really enjoy the talking heads."
docu... | true |
5443f17e7e8c428ddca74d4849c67bafbfb1c98c | Python | python-code-assignment/Prarthan.MR | /none_value_in_dictionary.py | UTF-8 | 361 | 2.859375 | 3 | [] | no_license | def dup(data):
for key, value in list(data.items()):
if isinstance(value, dict):
value=dup(value)
else:
if value==None:
data.pop(key)
return data
a={
3:{
'name':None, 'dept_id': 343,'address':{'City':None,'pincode':541283}
... | true |
de304eedae794b26249e31c0069b2f6b16521097 | Python | vincentpham1991/PythonProjects | /HiddenMarkovModelFraud/HMMArray.py | UTF-8 | 11,490 | 3.390625 | 3 | [] | no_license | import re, string, numpy, pylab
from numpy import *
def getAlphabet(obs):
'''
Retrieves the possible observation values.
Parameters
----------
obs: list of observations
Returns
--------
out: the alphabet as a list
'''
alphabet = []
for word in obs:
for c in word:
if c in alphabet:
pass
else... | true |
8f138fc59df40838141393f2c64a7050ff3de74f | Python | brosner/duktape-py | /test/test_duktape.py | UTF-8 | 1,520 | 2.75 | 3 | [
"MIT"
] | permissive | import gc
import tempfile
import duktape
import pytest
# todo: unicode tests everywhere and strings with nulls (i.e. I'm relying on null termination)
def test_create():
duktape.Context()
def test_eval_file():
ctx = duktape.Context()
with tempfile.NamedTemporaryFile() as tf:
tf.write(b"var a = ... | true |
d84f20886f41b84ab0c5e542c89ade356bd99bf2 | Python | rmkm/SenSim | /sensor/sensor_asyncio.py | UTF-8 | 2,302 | 2.53125 | 3 | [] | no_license | from pytz import timezone
from datetime import datetime
import numpy as np
import time, socket, sys, json, random, yaml, signal, asyncio
import generator
def signal_handler():
print('You pressed Ctrl+C!')
#file.close()
for task in asyncio.Task.all_tasks():
task.cancel()
def reader... | true |
92867f4c7bc6fda3da19bcd1f2fb2b6d80c1c9bc | Python | freechainer/Python_200 | /jupyter_notebook/data/022.py | UTF-8 | 105 | 3.84375 | 4 | [] | no_license | a = True
b = False
print(a == 1) # True가 출력됨
print(b != 0) # False가 출력됨
| true |
b35c79abd59f6b80d6a93fb724e09862046d947e | Python | nagellette/pub1_shape_to_raster | /labels_to_raster.py | UTF-8 | 1,042 | 2.6875 | 3 | [] | no_license | from osgeo import gdal, ogr
'''
Rasterize code reference: https://pcjericks.github.io/py-gdalogr-cookbook/raster_layers.html#get-raster-metadata
'''
# Define pixel_size and NoData value of new raster
pixel_size = 5.0
NoData_value = -9999
# Filename of input OGR file
vector_fn = './data/bejing_reduced_projected_reduc... | true |
46439e97fc0de71ddc98172d3f8652d563f481ba | Python | ArgonneDetectorGroup/fit_tools | /fit_tools.py | UTF-8 | 1,679 | 3.03125 | 3 | [] | no_license | #By: Faustin Carter (faustin.carter@gmail.com), 2017
import numpy as np
import lmfit as lf
import warnings
def do_lmfit(xdata, ydata, fit_fn, params, **kwargs):
"""Run any fit from models on your data.
Paramters
---------
xdata : np.array
The points at which to calculate the model.
ydata... | true |
b8fb03c066c80b185f71adefbe13cb6f24abac1e | Python | lesswrong-ru/generate-books | /html2fb2/compressedfile.py | UTF-8 | 6,859 | 3.15625 | 3 | [] | no_license | """Module to offer simple compressed file support by assuming the file
in interest is contained in a zip file. Allows reading to a file,
or writing to a file (but not both and not appending).
Right now this module deals with real files on disk (it uses im memory
for performance for the intermediate files so ther... | true |
5f65828b82eb8f769de7a00bb18c9b6adba51a3d | Python | SashaVin/project02 | /project02.py | UTF-8 | 319 | 3.234375 | 3 | [] | no_license | r = str.lower(input())
u = r.split(' ')
t = ''.join(u)
k = len(t) - 1
a = 0
q = 1
while k - a >= a:
if t[k - a] == t[a]:
a = a + 1
else:
q = 0
break
if q == 1:
print('Ого, это палиндром!')
if q == 0:
print('К сожалению, это не палиндром(')
| true |
5aacd324f7f8b9d64a39cbc2c05b9d45f6ad361c | Python | GRSEB9S/maxent-srl | /basic_struct.py | UTF-8 | 368 | 2.734375 | 3 | [
"MIT"
] | permissive | from collections import namedtuple
Frame = namedtuple('Frame', ['start', 'end', 'name'])
NodePosition = namedtuple('NodePosition', ['start', 'end'])
class Context(object):
def __init__(self, sentence, parse_tree, frame, node_pos):
self.sentence = sentence
self.parse_tree = parse_tree
self... | true |
4dba65ab47c0c48990a5d0f3125f1195ab381fdd | Python | Jack-Rutland/WorkoutStats | /src/main.py | UTF-8 | 1,571 | 3 | 3 | [] | no_license | '''
WORKOUT STATISTICS TRACKER
---------------------------------------------------------------------
AUTHOR : Jack Rutland
Description : A windows application written in python to log and
display information about your workouts.
'''
#IMPORTS
from os import listdir
from os import getcwd
from os.path import... | true |
fa6753e953578d93051b8f045a036a32fe58f7bd | Python | 13824125580/communication | /newbsp.py | UTF-8 | 4,799 | 2.796875 | 3 | [] | no_license | # -*- coding:utf-8 -*-
import numpy as np
from math import pi
import matplotlib.pyplot as plt
import matplotlib
import scipy.signal as signal
import math
#码元数
size = 4
sampling_t = 0.01
t = np.arange(0, size, sampling_t)
print(t)
# 随机生成信号序列
a = np.random.randint(0, 2, size)
for i in range(size):
... | true |
11b68ce96864361f1e99b2ecd8e18ecf24aba42f | Python | DreamonZhu/AI | /ML/zhoubo_ML_DL_2018_10/9_1.py | UTF-8 | 2,886 | 3.078125 | 3 | [] | no_license | import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import matplotlib as mpl
from sklearn.model_selection import train_test_split
from sklearn.linear_model import LinearRegression
df = pd.read_csv('./data/advertising.csv')
# print(df[['TV', 'Radio', 'Newspaper']])
x = df[['TV', 'Radio', 'Newspaper'... | true |
c73656bce92d7e8ccaaf4bc861b19db9128fd162 | Python | SreeramSP/Python-Function-Files-and-Dictionary-University-of-Michigan- | /#Write a function, accum, that takes a list.py | UTF-8 | 217 | 3.796875 | 4 | [] | no_license | #Write a function, accum, that takes a list of integers as input and returns the sum of those integers.
def accum(l):
i=0
for j in l:
i=i+j
return i
list1=[1,2,3,4,5]
print(accum(list1))
| true |
731ff229aa3f41ee456eabaf012fdd5529f98f38 | Python | nir-takemi/text_verifier | /verify_text.py | UTF-8 | 401 | 2.609375 | 3 | [
"MIT"
] | permissive | import sys
from textverifier import text_verifier as tv
def main():
args = sys.argv
if len(args) < 2 :
raise ValueError('''
Specify at least 1 argument.
usage:
python3 text_verifier.py "dir or file_path"
''')
# Execute
text_verifier = tv.TextVer... | true |
2e3504b4d6fb68998838e051853f97a119064cf1 | Python | ramostitoyostin-unprg/T08_RAMOS.SANCHEZ | /manipuladores_de_textos/longitud.py | UTF-8 | 2,627 | 3.859375 | 4 | [] | no_license | #MANIPULACION DE TEXTOS
#manipulador de texto nro 1
# 0123456789012345678
cadena="HOY TE IRÁ MUY BIEN"
print("la cadena",cadena,"tiene :",len(cadena),"elementos")
#manipulador de texto nro2
# 01234567890123456789012
cadena="SONRIE LA VIDA ES ÚNICA"
print("la cadena",cadena,"tiene :",len(cadena),"elementos... | true |
edeae1da5b26a923d1e55a6983926a633eeeccb2 | Python | sntran/trello-broker | /trello.py | UTF-8 | 4,769 | 2.734375 | 3 | [] | no_license | from packages import requests
import re
from brokers import BaseBroker
API_KEY = "d151447bdc437d1089c16011ff1933cf"
API_SECRET = "8889354115ce172246e3c0335fb0e4527c1ecafb5ac1437a7656356f1eb3b191"
BASE_URL = "https://api.trello.com/1"
MEMBER_URL = BASE_URL + "/tokens/%s/member"
BOARD_CARD_URL = BASE_URL + "/boards/%s/c... | true |
f3c50bbb6de8159ac50fcb5a9971fa7376b56cbe | Python | Shilpa106/notify_CLI | /sqlite_database/ex6.py | UTF-8 | 1,167 | 3.421875 | 3 | [] | no_license | import sqlite3
from sqlite3 import Error
def sql_connection():
try:
conn = sqlite3.connect('mydatabase.db')
return conn
except Error:
print(Error)
def sql_table(conn, rows):
cursorObj = conn.cursor()
# Create the table
cursorObj.execute("CREATE TABLE salesman(salesman_id n(5), name... | true |
842205d12b907dc8e3382b80bb1dc8f38f895935 | Python | matteo-peltarion/classification-toolkit | /palladio/config/konfiguration.template-mlc.py | UTF-8 | 3,292 | 2.5625 | 3 | [] | no_license | """
Konfiguration template file for image classification task
"""
from palladio.utils import get_data_augmentation_transforms
from torch.utils.data import RandomSampler
from palladio.networks.utils import get_network as pd_get_network
from torch.nn import BCEWithLogitsLoss
from sklearn.metrics import (
precisi... | true |
22b1f4aa2fff7f309da8413da23fb2f4fe52d157 | Python | kirankilva/Python_Games | /Number_Guessing_Game/guessNumber.py | UTF-8 | 5,838 | 3.4375 | 3 | [] | no_license | #Importing libraries
from tkinter import *
import random
from tkinter import messagebox as msg
#Code goes from here
class NumberGuess:
def __init__(self, root):
self.root = root
self.root.geometry('400x400+500+100')
self.root.title('Number Guessing Game')
#All variables
... | true |
6008c61b6ef3e8b383bf6c1070442727a2da0db6 | Python | Tsukigata/MonetaryDataSpider | /monetarySpider/spiders/realTimeSpider.py | UTF-8 | 2,776 | 2.59375 | 3 | [] | no_license | import scrapy
import json
from monetarySpider.items import MonetaryRealItem
from scrapy.http.request import Request
import time
#由于使用的IP质量不高所以导致数据的实时性有所下降,关于代理池的设定在middlewas和settings中的IPPOOLS中进行
class RealtimespiderSpider(scrapy.Spider):
name = 'realTimeSpider'
allowed_domains = ['vip.stock.finance.sina.com.cn... | true |
a7d5ff707a94dfb8761358eab9bca0f2aa06a9d4 | Python | AhmedElkhodary/Python-3-Programming-specialization | /1- Python Basics/FinalCourseAssignment/pro4.py | UTF-8 | 434 | 4.09375 | 4 | [] | no_license | #A palindrome is a phrase that, if reversed, would read the exact same.
#Write code that checks if p_phrase is a palindrome by reversing it
#and then checking if the reversed version is equal to the original.
#Assign the reversed version of p_phrase to the variable r_phrase so that we can check your work.
p_phrase =... | true |
2f61e708b7df8b16e2d4fbbfbf6a7bcfc9243add | Python | Orderlee/tjoeun | /pycharm/ch02/ex07.py | UTF-8 | 1,045 | 4.09375 | 4 | [] | no_license | number=3
#숫자이지만 문자열 형식으로 출력 가능함
a='나는 사과 %s개를 먹었다.' %number
print(a)
#%10s 10자리의 문자열(오른쪽 정렬)
a='나는 사과 %10s개를 먹었다.' %number
print(a)
# $-10s 10자리의 문자열 (왼쪽 정렬)
a='나는 사과 %-10s개를 먹었다.' %number
print(a)
# {}위치에 값이 입력됨
a='나는 사과 {}개를 먹었다.'.format(number)
print(a)
# >자리수: 오른쪽 정렬
# {변수인덱스:세부옵션}
a='나는 사과 {:>10}개... | true |
7ff972ce4da7bf0da9a78647372cc3789881c746 | Python | firemark/notebooks | /gil-prelection/draw.py | UTF-8 | 208 | 2.71875 | 3 | [] | no_license | #!/usr/bin/python2
from PIL import Image
from sys import stdin
width = 1200
height = 800
data = stdin.read()
img = Image.new('L', (width, height))
img.putdata([int(x) for x in data.split(' ')])
img.show()
| true |
80107ba7fc96cec13566ccb5866f585c590fac00 | Python | abagaria/sentiment-classification | /sentiment.py | UTF-8 | 11,367 | 2.859375 | 3 | [] | no_license | #!/usr/bin/env python3
from os import path
import argparse
import logging
import multiprocessing
import pickle
from collections import OrderedDict
import pdb
import time
import matplotlib.pyplot as plt
import seaborn as sns
sns.set()
import numpy as np
# Pytorch Imports
import torch
from torch import nn
from torch im... | true |
d2f16162fb39c6372c0d09bb8888832cbdd356f5 | Python | crcrpar/chainer | /tests/chainer_tests/utils_tests/test_cache.py | UTF-8 | 2,502 | 2.515625 | 3 | [
"MIT",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | import unittest
import numpy
import chainer
from chainer import testing
from chainer.utils import cache
class MockDistribution(object):
def __init__(self, x):
self.x = x
self.h_call_count = 0
self.y_call_count = 0
@cache.cached_property
def h(self):
self.h_call_count +=... | true |
a0b8226fd8878ee12ee01f52e02b430d27a8b831 | Python | ehddnr301/corona_dashboard | /bar.py | UTF-8 | 560 | 2.703125 | 3 | [] | no_license | import plotly.express as px
from data import totals_df
bar_chart = px.bar(totals_df,
x='condition',
y='count',
title='Total Case',
hover_data={
'count': ':,'
},
labels={
'condition' : 'Condition',
'c... | true |
1015d201991501c94aeb5a8c10d38a854dc9a014 | Python | DeSireFire/crawlProject | /wangyiMusic/crawl.py | UTF-8 | 5,704 | 2.5625 | 3 | [] | no_license | # -*- coding: UTF-8 –*-
'''
网易云音乐爬虫,现可以进行评论(热门评论以及全部评论)的爬取
作者:洪韬
时间:2020/3/11
'''
from Crypto.Cipher import AES
import base64
import requests
import json
import time
import csv
import os
import re
class wangyiCrawl:
def __init__(self):
self.Headers = {
'Accept': "*/*",
'Accept-Lan... | true |
b6960de14ba9bb85108b3ba0edfde141349570df | Python | sdutta21/DungeonCrawler | /pyGame/door.py | UTF-8 | 980 | 3.53125 | 4 | [] | no_license | """
File containing the door sprite class
"""
import pygame
from pygame.locals import RLEACCEL
class Door(pygame.sprite.Sprite):
"""
Class representing the door sprite
attrs:
surf: The pygame surf representing the sprite image
rect: The pygame rect representing the bounds of the sprite
... | true |
17c947c7a3280ed0b06c9d3da2619418268d0a12 | Python | judecodetech/grmp | /deployments/fabfile/tools.py | UTF-8 | 2,746 | 2.671875 | 3 | [] | no_license | """
This module contains all the tasks to get a new or exisiting
server up and running
"""
from fabric.api import cd, env, puts, run
from fabric.colors import green, red, yellow
from fabric.operations import sudo
from fabfile import git
LETSENCRYPT_DOWNLOAD = 'https://github.com/letsencrypt/letsencrypt'
LETSENCRYPT_... | true |
cc7cab87f03b024c6103ef5084ab3da2162c9cef | Python | GabrielDUBOIS/projet-1 | /src/gui_app_fab.py | UTF-8 | 12,232 | 2.953125 | 3 | [] | no_license | # -*- coding: Utf-8 -*-
### Importations des modules de la bibliotheque standard
import tkinter as tk
import abc
import xml.etree.ElementTree as ET
### Importations des modules des bibliotheques tierces
### Importations des modules du projet
from def_app_cmd import * # @UnusedWildImport
### Déclarations de consta... | true |
a1f02efcb524d62f219ec63499a323137a1bb4b5 | Python | 93suhwan/python-sos | /src/memory.py | UTF-8 | 774 | 3.46875 | 3 | [
"MIT"
] | permissive | from collections import OrderedDict
class Memory:
"""Memory is a finite mapping from locations to Num instances"""
def __init__(self):
self._store = OrderedDict()
def __str__(self):
h = 'Runtime Memory State'
lines = [h, '=' * len(h)]
for var, num in self._store.items():
... | true |
4e02331aca4398d5d14b51f92186993bd567ff9c | Python | akuhnregnier/empirical-fire-modelling | /tests/test_variable.py | UTF-8 | 4,540 | 2.609375 | 3 | [
"MIT"
] | permissive | # -*- coding: utf-8 -*-
from operator import methodcaller
import pytest
from empirical_fire_modelling import variable
@pytest.fixture
def dummy_variables():
variables = []
for rank, name, units in [(0, "foo", "1"), (1, "bar", "%")]:
for shift in [0, 1, 3, 6, 9]:
variables.append(
... | true |
1c9b8ad5205ebf55760dd6822ceb57559dd589db | Python | SauravKanchan/workshop | /main.py | UTF-8 | 347 | 3.984375 | 4 | [] | no_license | data = input("Enter your data")
number = int(data)
# this for loop which starts from 0 and ends at 12.k
for i in range(1,13):
print(number, "X",i,"=", i*number )
print("End of loop")
'''
count = 0
while count<=12:
print(number, "X",count,"=", count*number )
count = count +1
print("End of while loop")
'... | true |
cd6a1d2dfcddb356c8ea0b62ff7d0a5a66a30f0e | Python | no-more-coffee/my-interview-questions | /leet/Weekly Contest 181/1.py | UTF-8 | 465 | 3.515625 | 4 | [] | no_license | from typing import List
class Solution:
def createTargetArray(self, nums: List[int], index: List[int]) -> List[int]:
a = []
for i, n in zip(index, nums):
print(i, n)
a.insert(i, n)
return a
print(Solution().createTargetArray(nums=[0, 1, 2, 3, 4], index=[0, 1, 2, 2... | true |
a3541cc3bd6d92f12eb3b9271ae64a163906f929 | Python | huiboSong/tester | /core/logger.py | UTF-8 | 1,854 | 2.953125 | 3 | [] | no_license | # coding=utf-8
import sys
# reload(sys)
# sys.setdefaultencoding('utf-8')
__author__ = 'qiguojie'
__date__ = '2016-11-30'
import datetime, os
import config
class Logger(object):
def __init__(self):
# 要写入log的目录,这个需要在config中配置
self.log_dir = config.log_file_dir
def log_write(self, message):
... | true |
198adf60567ff5f3a73ad1edd98db62cbeef76d0 | Python | prashkumara/Data-Structures | /LeetCode/501.Find_Mode_in_Binary_Search_Tree.py | UTF-8 | 724 | 3.28125 | 3 | [] | no_license | # Definition for a binary tree node.
# class TreeNode(object):
# def __init__(self, x):
# self.val = x
# self.left = None
# self.right = None
import collections
class Solution(object):
def findMode(self, root):
"""
:type root: TreeNode
:rtype: List[int]
... | true |
6ab7eea38cae655c4081853048f27b442f5fe90a | Python | crushthehype/magic | /onix.py | UTF-8 | 1,260 | 2.6875 | 3 | [] | no_license | import bitmex
import pandas as pd
import numpy as np
import requests, json
import lxml
apiKey = ''
apiSecret = ''
# Connecting to client
client = bitmex.bitmex(test = False, api_key=apiKey, api_secret=apiSecret)
# fetching trade execution history
r = client.Execution.Execution_getTradeHistory().result()
... | true |
bff4c33683c77c87e5871a8d88394b0bccf5ee7e | Python | Wenhao-Yang/PythonLearning | /Chapter 3 Linear Regression/3.2_DecompositionMethod.py | UTF-8 | 2,162 | 3.6875 | 4 | [] | no_license | #!/usr/bin/env python
# encoding: utf-8
"""
@author: yangwenhao
@contact: 874681044@qq.com
@software: PyCharm
@file: 3.2_DecompositionMethod.py
@time: 2018/12/11 下午5:07
@overview: We implement a matrix decomposition method for linear method. Implementing inverse methods in the previous recipe can be numerically ineffi... | true |
9e736ea2bc7b3ec2f559003c062218675f391160 | Python | abhisheksaurabh1985/CI-Project | /testScripts.py | UTF-8 | 595 | 2.640625 | 3 | [] | no_license | # Test scripts for the function generateWordWindows(). File generated is in the output folder.
with open("./output/testGenerateWordWindows.txt", "w") as textFileObj:
for i in range(11):
textFileObj.write(str(all_sentences[i]) + '\n')
textFileObj.write(str(nestedListSentenceTuples[i]) + '\n')
... | true |
0dd8c89da3033e345c0fc9f4aa3585003b317900 | Python | dozernz/assorted-pub | /aio-multiproc.py | UTF-8 | 1,049 | 2.59375 | 3 | [] | no_license | import asyncio,aiohttp
import concurrent.futures
import time
NUM_PROCS=2
NUM_SESS=4
PER_SESS=10000
async def long_task():
async with aiohttp.ClientSession() as session:
for i in range(PER_SESS):
async with session.get('http://127.0.0.1') as response:
html = await response.text(... | true |
60d899681bd0e175af2faf5d08a2cdf089eb2e2a | Python | PaddlePaddle/Paddle | /python/paddle/text/datasets/imikolov.py | UTF-8 | 6,040 | 2.6875 | 3 | [
"Apache-2.0"
] | permissive | # Copyright (c) 2020 PaddlePaddle Authors. 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 app... | true |
f18931710416e613fa2d4a1a9befabca87ac474e | Python | eduardomezencio/tsim | /tsim/core/network/orientedway.py | UTF-8 | 4,653 | 2.78125 | 3 | [
"MIT"
] | permissive | """OrientedWay class."""
from __future__ import annotations
from dataclasses import dataclass
from typing import (TYPE_CHECKING, Iterable, Iterator, NamedTuple, Optional,
Tuple)
from dataslots import with_slots
from tsim.core.entity import EntityRef
from tsim.core.network.endpoint import Endpoin... | true |
07baa94ce6ad5453d2145ea19706190f42489058 | Python | gswyhq/hello-world | /python相关/十进制与62进制的转换.py | UTF-8 | 3,760 | 3.890625 | 4 | [] | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
# 对于62进制,从0数到9以后,10用小写字母a表示,接着数完26个字母,到z为35,然后36为大写字母A,一直到61为大写字母Z。所以,我们可以实现十进制数字base62编码的encode和decode。
import math
ALPHABET = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
def base62_encode(num, alphabet=ALPHABET):
"""Encode a number in Base X
... | true |
e59bb70c95d6138373bffeb524bb18e6008a621b | Python | wsifan/debt-test | /runtest.py | UTF-8 | 1,063 | 2.703125 | 3 | [] | no_license | import unittest
import json
import requests
from HTMLTestRunner import HTMLTestRunner
import time
#加载测试文件
from test_case import test_userlogin
#构造测试集
suit = unittest.TestSuite()
#TestSuite类的addTest()方法把不同测试类中的测试方法组装到测试套件中。
#增加测试用例==》接口文件名.接口类(方法也就是这个接口的其他用例),要把每一个测试用例都增加进来!!!
suit.addTest()
if __name__ =... | true |
580440516626018c601dd8576c605fc36e875c18 | Python | Aasthaengg/IBMdataset | /Python_codes/p03252/s714583260.py | UTF-8 | 773 | 2.84375 | 3 | [] | no_license | import sys
import itertools
# import numpy as np
import time
import math
import heapq
from collections import defaultdict
sys.setrecursionlimit(10 ** 7)
INF = 10 ** 18
MOD = 10 ** 9 + 7
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
# map(int, input().split()... | true |
4456000c4d81804cd6092cd7214dbe5bfc892ca3 | Python | Sirius1942/skiWorkSpace | /drivers/KippRequests.py | UTF-8 | 384 | 2.84375 | 3 | [] | no_license | import requests
# 发送消息格式:{"url":"www.baidu.com"}
def request(data):
r = requests.get(url="http://www.baidu.com") # 最基本的GET请求
return r
# print(r.status_code) # 获取返回状态
# r = requests.get(url='http://dict.baidu.com/s', params={'wd':'python'}) #带参数的GET请求
# print(r.url)
# print(r.t... | true |
a2145373dd173a36f06ab3dfc87e9674acee5613 | Python | StanleyGoldman/TitanicPython | /main_tests.py | UTF-8 | 4,257 | 2.90625 | 3 | [] | no_license | import main
from unittest import TestCase
class Test_extract_cabin_floor(TestCase):
def test_none(self):
self.assertEqual(main.extract_cabin_floor(None), None)
def test_empty(self):
self.assertEqual(main.extract_cabin_floor(""), None)
def test_single_floor(self):
self.assertEqual... | true |
2e6d26eeddc87de2aa50efd13aad7a1242d77460 | Python | jasaaved/Resume | /Python Game/battle_effectiveness.py | UTF-8 | 5,545 | 3.140625 | 3 | [] | no_license | import pokemon_info
import random
from collections import namedtuple
def attack_effectiveness(attacker: namedtuple, defender: namedtuple) -> str:
'''
Determines the effectiveness of an attack. Some Pokemon are dual types so this function takes account of that
'''
result = 0
for att_type in attacker.... | true |
59a0d4a8a668ea1adfb1dc941643bffc34131ccc | Python | Xen0neX/mocking_in_tdd | /d_roll.py | UTF-8 | 194 | 2.546875 | 3 | [] | no_license | #Arihant Kunda
#June 16, 2021
#Idea for project taken from: https://www.youtube.com/watch?v=6tNS--WetLI
import random
def roll_dice():
"""sumlates a dice roll"""
return random.randint(1, 6)
| true |
819de3000b7b8f6f382d44b970fd7c0e061eb4da | Python | Aasthaengg/IBMdataset | /Python_codes/p02382/s246119089.py | UTF-8 | 522 | 3.453125 | 3 | [] | no_license | #
# 10d
#
import math
def main():
n = int(input())
x = list(map(int, input().split()))
y = list(map(int, input().split()))
d1 = 0
d2 = 0
d3 = 0
dn = 0
for i in range(n):
d1 += abs(x[i] - y[i])
d2 += (x[i] - y[i])**2
d3 += abs(x[i] - y[i])**3
dn = max(dn,... | true |
0716893552a36be73beab169e467997cef9b1e08 | Python | RashmiTiwari132/ProjectS3Lab | /my_application/samplepython.py | UTF-8 | 56 | 3.171875 | 3 | [] | no_license | for x in range(0, 10):
print "We are on time %d" % (x)
| true |
f4070f1f521e873bdd0a45076c703c34c991a9d1 | Python | dodonmountain/algorithm | /2019_late/20190827/swea_4880_토너먼트카드게임.py | UTF-8 | 762 | 3.546875 | 4 | [] | no_license | import sys
sys.stdin = open("input.txt")
T = int(input())
def game(a, b): # 가위바위보, 낸 손 모양이 아니라 인덱스를 리턴해야함
A, B = lst[a-1], lst[b-1]
vs = {1: 3, 2: 1, 3: 2}
if vs[A] == B:
return a
if vs[B] == A:
return b
return a
def divide(start, end):
if start == end: # 종료 조건. 시작과 끝이 같으면... | true |
158a6a81f2da23d8c976a20fddb35f17ebf5a02f | Python | amarendrafst/NeuralMap | /tests/tests_neighbourhood_functions.py | UTF-8 | 7,007 | 2.8125 | 3 | [
"MIT"
] | permissive | import unittest
import numpy as np
from ..neural_map import bubble, conical, gaussian, gaussian_cut, mexican_hat, no_neighbourhood
TOLERANCE = 1e-8
def euclidean(f_element, s_element):
return ((f_element[0] - s_element[0]) ** 2 + (f_element[1] - s_element[1]) ** 2) ** 0.5
cart_coord = np.array([
[[0.5, 0.]... | true |
daddd439cb88ee3b68351601f8f8f32007ae44e4 | Python | Vidoux/N_Reines-Algo_Avanc- | /Damier.py | UTF-8 | 1,158 | 3.015625 | 3 | [] | no_license | class Damier:
def __init__(self, taille):
self.taille = taille
self.grille = self.__new_grille()
def supprimer_dame(self, coordonnées):
self.grille[coordonnées.ligne][coordonnées.colonne] = 0
def set_case_dame(self, coordonnées):
self.grille[coordonnées.ligne][coordonnées.... | true |
0455709f02f02308842ccd7587a452cf3965ea39 | Python | MachinaExHumane/voice-dataset-creation | /scripts/markersfile_to_metadata.py | UTF-8 | 3,073 | 2.609375 | 3 | [] | no_license | import argparse
import os
import sys
from shutil import copyfile, rmtree
import pandas as pd
def audition(wavs_export_path, wavs_final_path, input_filename, output_filename):
create_metadata_and_wavs("audition", wavs_export_path, wavs_final_path, input_filename, output_filename)
def audacity(wavs_export_path, wav... | true |
aa1bebd2cfbf29fb05e291f9c1ae5624f762d97f | Python | delebasyq/bitmex-algo | /rtTrader.py | UTF-8 | 2,466 | 2.71875 | 3 | [] | no_license | import redis
import redisCommands as rd
import pandas as pd
import threading
import concurrent.futures
from datetime import datetime
import redisCommands as rd
import time
import random
#Realtime trading parameters
symbol = 'XBTUSD'
qty = -1
def wait_until(func):
while(True):
s = xstream.xbid.read()
... | true |
d0df9396e098618c6e19e793b4633f6a977c9d8a | Python | bobby20180331/Algorithms | /LeetCode/python/_290.WordPattern.py | UTF-8 | 2,537 | 3.671875 | 4 | [] | no_license | # 虽然是自己写自己调试的,但是参考了别人的思路,说是什么集合论双射,先打上_吧。35ms,超过93%。
class Solution(object):
def wordPattern(self, pattern, str):
"""
:type pattern: str
:type str: str
:rtype: bool
"""
ss = str.split(' ')
if len(pattern)!=len(ss):
return False
t= {}
... | true |
274724d5298457c6689e4ad5b2504cd70318dd7a | Python | cmsflash/wealth-projector | /projector.py | UTF-8 | 4,906 | 3.421875 | 3 | [] | no_license | TAX_BRACKETS = [
(0, 9700, 0.1),
(9700, 39475, 0.12),
(39475, 84200, 0.22),
(84200, 160725, 0.24),
(160726, 204100, 0.32),
(204100, 306750, 0.35),
(306750, float('inf'), 0.37),
]
def format_worth(label, value):
dollar_string = f'{value:,.02f}'.rjust(15)
string = f'{label:20s}{dollar... | true |