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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
52841d5494899552a8043540b67647b670de3ad0 | Python | chairco/VideoStabilizer-_OpenCV2-Python | /02_Filter2DnHistogram.py | UTF-8 | 1,182 | 2.6875 | 3 | [] | no_license | import cv2
import sys
import numpy as np
if len(sys.argv)!=2:
print "Usage : python display_image.py <image_file>"
else:
img = cv2.imread(sys.argv[1], cv2.CV_LOAD_IMAGE_COLOR)
#img = cv2.imread('graf1.png')
(h, w) = img.shape[:2]
clone_img = cv2.resize(img, (w/2, h/2), interpolation=cv2.INTER_N... | true |
f2c3a862b15fff480290117d4b89a90dc1b65d06 | Python | r-souza/dio-security-with-python | /web/web_scraping.py | UTF-8 | 384 | 2.6875 | 3 | [] | no_license | from bs4 import BeautifulSoup
import requests
uri = 'https://www.avare.sp.gov.br'
website = requests.get(uri)
soup = BeautifulSoup(website.content, 'html.parser')
min_temperture = soup.find('span', class_='minClima')
max_temperture = soup.find('span', class_='maxClima')
print(min_temperture.text)
print(max_tempertu... | true |
e8bfb6896bd2c4b3833e47a6dc3c3261a94f7824 | Python | armory3d/armory | /blender/arm/logicnode/object/LN_get_distance.py | UTF-8 | 566 | 2.734375 | 3 | [
"Zlib",
"GPL-2.0-only"
] | permissive | from arm.logicnode.arm_nodes import *
class GetDistanceNode(ArmLogicTreeNode):
"""Returns the euclidian distance between the two given objects.
@see For distance between two locations, use the `Distance` operator
in the *[`Vector Math`](#vector-math)* node."""
bl_idname = 'LNGetDistanceNode'
b... | true |
2954943f77bc50b79c9403efe3a833e220a9c7ec | Python | markphuong/phylogenetics.targetcapture.pilot | /0filter/0.5concatenate_reads.py | UTF-8 | 1,374 | 2.875 | 3 | [] | no_license | #!/usr/bin/env python
#this concatenates all read files into R1 and R2 files [if you get multiple read files per index from illumina]
import os
import sys
import argparse
import multiprocessing
def get_args(): #arguments needed to give to this script
parser = argparse.ArgumentParser(description="concatenate reads... | true |
b5af5d247d07f36568b13faf29b562a1a511ec53 | Python | Ylahjaily/python-td2 | /exercice2.py | UTF-8 | 253 | 3.5625 | 4 | [] | no_license | ##Create a range with decimal increment
def newRange(start, stop, step):
x = start
while x < stop:
yield x
x += step
x = newRange(0, 5, 0.2)
next(x)
##Chercher les occcurences des lettres dans un fichier, par block
| true |
f3f573dcabb9e94ba62cf5d3766a20f90c23515f | Python | ShitalBorganve/raspberrypi | /projects/image_processing/imgclient.py | UTF-8 | 1,463 | 2.765625 | 3 | [] | no_license | from pimote import *
import sys
import time
import move_robot_with_hands as moveRobot
# ROBOT_CONTROL actions
LEFT_OFF = "1,0,0"
LEFT_UP = "1,0,1"
LEFT_DOWN = "1,0,3"
RIGHT_OFF = "1,0,4"
RIGHT_UP = "1,0,5"
RIGHT_DOWN = "1,0,7"
ip = sys.argv[1]
port = int(sys.argv[2])
running = False
class MyClient(Client):
d... | true |
6af6161241aeb8fd628d1d0540799b4cad16f577 | Python | cutejiejie/Algorithms | /查找排序/select_sort.py | UTF-8 | 531 | 3.703125 | 4 | [] | no_license | def select_sort_simple(li):
li_new = []
for i in range(len(li)):
min_val = min(li)
li_new.append(min_val)
li.remove(min_val)
return li_new
def select_sort(li):
for i in range(len(li) - 1): #第i趟
min_loc = i
for j in range(i+1, len(li)):
if li[j] < li[m... | true |
ac89e65d561d860a93e778a04ebd2a01d8ab6ed5 | Python | nirvguy/torchtrainer | /tests/tests_trainers.py | UTF-8 | 7,652 | 2.78125 | 3 | [
"MIT"
] | permissive | import math
from torch.utils.data import TensorDataset, DataLoader
import torchtrainer
from torchtrainer import SupervisedTrainer, AutoencoderTrainer
from torchtrainer.base import ValidationGranularity
from .common import *
def sign(x):
return 1 if x > 0 else -1
class TrainerTests(unittest.TestCase):
def setU... | true |
798737d3cfdd28aa963610ff4490d2759650eaf4 | Python | Jeukoh/OJ | /Programmers/42626_더_맵게.py | UTF-8 | 331 | 3 | 3 | [] | no_license | from heapq import heapify, heappush, heappop
def solution(scoville, K):
anw = 0
heapify(scoville)
while scoville[0] < K and len(scoville) >= 2:
a = heappop(scoville)
b = heappop(scoville)
heappush(scoville, a + 2 * b)
anw += 1
if scoville[0] < K:
return -1
... | true |
a3232c54420d862a0c6a0469558edcb7f3d6b17e | Python | wenyaowu/leetcode-js | /problems/longestPalindromicSubstring.py | UTF-8 | 1,068 | 3.953125 | 4 | [] | no_license | """
Given a string s, find the longest palindromic substring in s. You may assume that the maximum length of s is 1000.
Example 1:
Input: "babad"
Output: "bab"
Note: "aba" is also a valid answer.
Example 2:
Input: "cbbd"
Output: "bb"
"""
class Solution:
def longestPalindrome(self, s: str) -> str:
# DP: ... | true |
6c26dde9ee539df3b77ed920c0dd2c914047547d | Python | sowrd299/SillyRobots | /returnSubroutine.py | UTF-8 | 620 | 2.734375 | 3 | [] | no_license | from subroutine import Subroutine
class ReturnSubroutine(Subroutine):
default_ally_area = [True, False, True]
default_enemy_area = [True]
def __init__(self, effect_enemy = False):
super().__init__(area = self.default_enemy_area if effect_enemy else self.default_ally_area)
self._effect_ene... | true |
ed048ae93f155110e60b185f1728a89acdf1046c | Python | kumgleb/Crop_Yield_Prediction_Challenge | /dataloader/transforms.py | UTF-8 | 648 | 2.75 | 3 | [] | no_license | from torchvision.transforms import transforms
class Normalize(object):
def __init__(self, mean, std):
self.normalizer = transforms.Normalize(mean, std)
def __call__(self, sample):
s2_bands = sample['s2_bands']
sample['s2_bands'] = self.normalizer(s2_bands)
return sam... | true |
f8c9aedaad86821c0ff673e066d503ddb80eca53 | Python | akshay-sahu-dev/PySolutions | /Hackerrank/Problem_Solving/Minimum distance.py | UTF-8 | 680 | 3.109375 | 3 | [] | no_license | #!/bin/python3
## https://www.hackerrank.com/challenges/minimum-distances/problem
import math
import os
import random
import re
import sys
# Complete the minimumDistances function below.
def minimumDistances(a):
L =len(a)
dist = L
for i in range(L):
for j in range(i+1,L):
if a[i] ... | true |
e4601ce4088ef62395321e773f6e5a248d136010 | Python | shanJoy/core_python | /ch09_WebCS/parse_links.py | UTF-8 | 2,332 | 2.90625 | 3 | [
"MIT"
] | permissive | __Author__ = "noduez"
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Time : 2019/7/11 10:19 AM
# @File : parse_links.py 链接解释器
# @Software: PyCharm
from html.parser import HTMLParser
from io import StringIO
from urllib.request import urlopen
from urllib.parse import urljoin
from bs4 import BeautifulSoup, SoupS... | true |
4c79abfb3696852e62dc3e1701024e68fe721f20 | Python | TheGreatTwig/tile-strategy | /functions.py | UTF-8 | 1,288 | 2.9375 | 3 | [] | no_license | import pygame, inputcontrol
def returnForUnitPosition(width,height,unitposition,objectsPerWidth):
if inputcontrol.getMouseOverSquare(width, height, objectsPerWidth) == unitposition+1:
if (unitposition+1) % objectsPerWidth != 0:
return True
elif inputcontrol.getMouseOverSquare(width, height,... | true |
8df0f31c87669b992587bf0590db1ffad9050a95 | Python | bhavyatrivedi7/Python-Assignment-4 | /2.py | UTF-8 | 152 | 3.1875 | 3 | [] | no_license | numlist=[]
for i in range(5,10):
numlist.append(i)
print(numlist)
numlist.reverse()
print(numlist)
num=[1,1,2,4,5,6,7,7,9,4,4]
n=num.count(7)
print(n)
| true |
ce78d31924fb71177d9a3113bbc3f4c49c0dfd5a | Python | miseop25/Back_Jun_Code_Study | /back_joon/브루트포스/back_joon_1107_리모컨/back_joon_1107_ver1.py | UTF-8 | 651 | 2.75 | 3 | [] | no_license | def soluction(N, num) :
if N == 100 :
return 0
if len(num) == 0 :
return abs(100 - N)
ansList = [abs(N- 100)]
nStr = str(N)
cnt = 0
st = ""
for i in nStr :
temp = sorted(num, key= lambda x: abs(x-int(i)))
st += str(temp[0])
cnt += len(str(int(st)))
cnt... | true |
7017429d4793ee2342bab6f84fabdbca8bfa86cf | Python | kamalnainx/PYTHON | /python 2pm weekend April 2021/py27_file_handling.py | UTF-8 | 1,553 | 3.3125 | 3 | [] | no_license | # a=append
# x=create
# w=over write
# f=open("file/demo1.txt","x")
# f.close()
# f=open("file/demo1.txt","x")
# f.write("this is my first file.")
# f.close()
f=open("file/demo1.csv","x")
f.write("item , month1,month2,month3\n")
f.write("item , 10,20,30\n")
f.write("item , 11,22,33\n")
f.write("item , 100,200,300\... | true |
db4213b500a59ecc2237fe78925362856bf9a911 | Python | dr-dos-ok/Code_Jam_Webscraper | /solutions_python/Problem_108/45.py | UTF-8 | 775 | 2.828125 | 3 | [] | no_license | import math
def solve(D, vines):
vines.append((D, 0)) # treat lover as vine
vines.sort()
reach = [-1]*len(vines)
reach[0] = vines[0][0]
for i in xrange(len(vines)):
h = reach[i]
if h < 0:
break
di = vines[i][0]
for j in xrange(i+1, len(vines)):
... | true |
cecfed5be9cef8481175ba2956642a2a0ffb3719 | Python | Christopher-P/AIQ | /AIQ/agents/random_agent.py | UTF-8 | 594 | 2.921875 | 3 | [] | no_license | # Implemention of random agent
import numpy as np
class R_Agent():
def __init__(self):
return None
# Called for RL type tests
def act(self, header, data):
# Ignore data because this is a random agent!
size = header.input_dim
return np.random.choice(size[0], 1)
# C... | true |
86ad8c2471e197cdbca19d57615788f4adbbba1c | Python | haruyasu/Houdini_Python | /tutorial/Week5/sticky_inputs.py | UTF-8 | 1,714 | 3.015625 | 3 | [] | no_license | # get the types so that we can create nodes later
# we are defining these here so that it is easy to change things like versions
# later.
crate_type = 'crate'
sticky_type = 'sticky_input'
# get the first selected node to base the setup on
if hou.selectedNodes():
# this will be the node we will use to base the setu... | true |
1165616a85eb3718a06cc26dc0575077bc5ed0bd | Python | emmettFC/selected-projects | /dep/va_offenders_database/scripts/NY/NY-SOF-Scrape.py | UTF-8 | 4,991 | 2.796875 | 3 | [] | no_license | '''
NY State SOF Registry Scrape:
I: Use selenium driver to manually get past captcha
II: Get all valid offender ID numbers through zip code
III: Iterate over all offender links and get page info
'''
# --
# Dependancies
from selenium import webdriver
from selenium.webdriver.common.ac... | true |
4e3cd255276b9fe0ca1626582161ca4d38062971 | Python | AlimiG/Euler | /25_fibonacci_number.py | UTF-8 | 301 | 3.359375 | 3 | [] | no_license | import time
start = time.time()
print(len(str(3508)))
def createfibo(n):
fib = [1,1]
for i in range(1,n):
fib.append(fib[i]+fib[i-1])
return fib
fib = createfibo(10000)
for i in fib:
if len(str(i)) == 3:
print(fib.index(i)+1)
break
print(time.time() - start) | true |
a3baf30a557f33026f445fa09910d91584632be5 | Python | rapydo/do | /controller/commands/version.py | UTF-8 | 1,317 | 2.515625 | 3 | [
"MIT"
] | permissive | """
Show RAPyDo and project version details
"""
from packaging.version import Version
from controller import RED, __version__, colors
from controller.app import Application, Configuration
@Application.app.command(help="Show rapydo and project version details")
def version() -> None:
Application.print_command()
... | true |
6ec77b4145dfc37f0f2f701307ba73aecc37e1fd | Python | Rushi21-kesh/My-Stock-Profile-App-Using-Python | /login.py | UTF-8 | 3,915 | 2.9375 | 3 | [] | no_license | # required libraries
from datetime import date
import pymongo
from send_mail import mail_send
import pprint
import numpy
from bson.json_util import dumps
# connecting string
client = pymongo.MongoClient("mongodb://127.0.0.1:27017")
mydb = client['project0']
mycol = mydb['clientdata']
def opetion(email):
... | true |
7eaf55b56f354108c8e82f51a52a044f8fcc029e | Python | carryAiYu/edward | /examples/normal_hmc.py | UTF-8 | 759 | 2.5625 | 3 | [
"Apache-2.0"
] | permissive | #!/usr/bin/env python
"""Correlated normal posterior. Inference with Hamiltonian Monte Carlo.
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import edward as ed
import tensorflow as tf
from edward.models import Empirical, MultivariateNormalTriL
ed.set... | true |
a63fe3c3f655e1feb0a2518a86dd8a3a33789d52 | Python | hyunohenn/TIL | /algorithm/SWEA/SWEA_2819_격자판의숫자이어붙이기_이현경.py | UTF-8 | 640 | 3.21875 | 3 | [] | no_license | # 격자판의 숫자 이어붙이기
delta = [[1, 0], [-1, 0], [0, 1], [0, -1]]
def DFS(r, c, distance, num):
num += arr[r][c]
distance += 1
if distance == 7:
nums.append(num)
return
for d in range(4):
nr = r + delta[d][0]
nc = c + delta[d][1]
if nr >= 0 and nr < 4 and nc >= 0 an... | true |
0b70524f082cd72200e672292ed9855179d72214 | Python | hieuvp/learning-python | /data-science/pandas-basics/select_data.py | UTF-8 | 365 | 3.6875 | 4 | [] | no_license | import pandas as pd
# Import "cars" data
cars = pd.read_csv("cars.csv", index_col=0)
print("+ cars\n%s\n" % cars)
# "iloc" is integer index based
# Print out observation for Japan
print("+ cars.iloc[2]\n%s\n" % cars.iloc[2])
# "loc" is label based
# Print out observations for Australia and Egypt
print('+ cars.loc[["... | true |
d0371e84205b45fef54f750aa535682b2c03b371 | Python | matthijsbos/fpgaedu-nexys4-python | /tests/hdl/test_baudgen.py | UTF-8 | 3,511 | 2.59375 | 3 | [
"Apache-2.0"
] | permissive | from myhdl import (Signal, ResetSignal, intbv, Simulation, StopSimulation,
instance, delay, now, traceSignals)
from math import ceil
import unittest
from unittest import TestCase
from random import randint
from fpgaedu.hdl import BaudGen, ClockGen
class BaudGenTestCase(TestCase):
BAUDRATE = 230401
... | true |
8c548fc5dffbad9f5caa89226a425e1a2aa6c1e0 | Python | Tarapatina/lenal | /dima_python/20/09.py | UTF-8 | 165 | 2.75 | 3 | [] | no_license | def returnik (a):
b=a%100
if b==0:
return (True)
else:
return (False)
returnik (500)
a1=False
a2=True
print(a1,a2) | true |
3e99b2895f6c2a236e3261e3bb68086949b9fceb | Python | shellcreasy/python_study | /if.py | UTF-8 | 575 | 4.1875 | 4 | [] | no_license | #遍历cars
cars = ['audi','bmw','subaru','toyota']
for car in cars:
if car == 'bmw':
print(car.upper())
else:
print(car.title())
#不相等 !=
#与 and
#或 or
#包含 in
#不包含 not in
#真 True
#假 False
#if-elife-else 结构
age = 12
if age < 4:
print("your admission cost is $0")
elif age < 18:
print("your admission cost is $5... | true |
a44f50e25b552b152d6a2b3a895a63fb539d18ae | Python | yyc1018/330 | /leastSquares.py | UTF-8 | 4,043 | 2.734375 | 3 | [] | no_license | import pandas as pd
import numpy as np
import math as m
from scipy.integrate import odeint
from lmfit import Parameters, minimize, report_fit
########################################################################################################################
# Load data
ssMean = pd.read_csv('/Users/katherine.yych... | true |
dc1367f852109e887de01dca93ad91199d3fe791 | Python | parthness/emotion_tweets | /python_codes/test.py | UTF-8 | 2,283 | 2.578125 | 3 | [] | no_license | import string
from nltk.tokenize import word_tokenize
'''
punctuations=list(string.punctuation)
dict={}
n=1
with open('final_dict_slangs.txt','r') as f:
for slang in f:
slang=slang.split(':')
key=slang[0].strip()
value=slang[1].strip()
dict[key]=value
w=open('final_dict_slangs.txt... | true |
fa7037573a6eccf55dc0be9fb14c2ca0cff0380d | Python | Runsheng/mitovar | /utils.py | UTF-8 | 3,651 | 2.546875 | 3 | [] | no_license | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Time : 2016/12/8 16:58
# @Author : Runsheng
# @File : utils.py
import subprocess
import sys
import signal
import os
import fnmatch
import multiprocessing
import unittest
from Bio import SeqIO
def myexe(cmd, timeout=0):
"""
a simple wrap of the shel... | true |
1eff5a329dc084d445b795c62597d1f5affa5999 | Python | NUAA-AL/ALiPy | /alipy/query_strategy/query_type.py | UTF-8 | 6,846 | 2.765625 | 3 | [
"BSD-3-Clause"
] | permissive | """
Query type related functions.
ALiPy implements IJCAI'15 Multi-Label Active Learning:
Query Type Matters (AURO) method which queries the relevance
ordering of the 2 selected labels of an instance in multi label setting,
i.e., ask the oracle which of the two labels is more relevant to the instance.
Due to the less a... | true |
95c40e40d0635366055431b9c09f7fe7cb1ef803 | Python | aobo-y/SouthPark-Chatbot | /src/trainer.py | UTF-8 | 5,911 | 2.75 | 3 | [] | no_license | """
Train seq2seq
"""
import os
import math
import random
from datetime import datetime
import torch
from torch import optim
import config
from utils.data import batch_2_seq
DIR_PATH = os.path.dirname(__file__)
USE_CUDA = torch.cuda.is_available()
DEVICE = torch.device("cuda" if USE_CUDA else "cpu")
# Inverse sigm... | true |
1d22b70dd9f46fb3d856ee49b3f60ea1fe09f73e | Python | Mkerian10/PokerHandEvaluator | /python/phevaluator/examples.py | UTF-8 | 1,558 | 4.03125 | 4 | [
"Apache-2.0"
] | permissive | from evaluator.evaluator import evaluate_cards
def example1():
print('Example 1: A Texas Holdem example')
a = 7 * 4 + 0 # 9c
b = 2 * 4 + 0 # 4c
c = 2 * 4 + 3 # 4s
d = 7 * 4 + 1 # 9d
e = 2 * 4 + 2 # 4h
# Player 1
f = 10 * 4 + 0 # Qc
g = 4 * 4 + 0 # 6c
# Player 2
h = 0 * 4 + 0 # 2c
i = 7 * 4... | true |
09d5df22bce7101f65bccf8557ee4b7f2315e3e8 | Python | fighting41love/TextAttack | /textattack/models/helpers/bert_for_classification.py | UTF-8 | 1,098 | 2.5625 | 3 | [
"MIT"
] | permissive | from textattack.shared import utils
import torch
from textattack.tokenizers import BERTTokenizer, BERTEntailmentTokenizer
from transformers.modeling_bert import BertForSequenceClassification
class BERTForClassification:
"""
BERT fine-tuned for textual classification.
Args:
model_path(:obj:`stri... | true |
e6b46cc511dc7dbc240c6a3e85293b26f390b43d | Python | MrTuesday1020/Suda9900 | /S2S/S2S/public/help.py | UTF-8 | 2,029 | 2.671875 | 3 | [] | no_license | from django.db import connection
from public.models import *
# help functions
def RunSQL(sql):
with connection.cursor() as cursor:
cursor.execute(sql)
rows = cursor.fetchall()
fieldnames = [name[0] for name in cursor.description]
results = []
for row in rows:
result = {}
for i in range(len(row)):
... | true |
f0ff5f0a7229e1d1b674bd99362bc9c02ca92aeb | Python | JeeYz/git_from_the_hell | /for_practice/practice_tensorflow_02.py | UTF-8 | 652 | 3.15625 | 3 | [] | no_license | # @Author: JayY
# @Date: 2018-08-31T09:36:07+09:00
# @Filename: new_21.py
# @Last modified by: JayY
# @Last modified time: 2018-11-06T15:22:45+09:00
# @Copyright: JayY
# new_21.py
# making matrix with tensorflow
# ==========================================
import numpy as np
import tensorflow as tf
# 하나의 값으로 채우기... | true |
2de97decf4e1c42d48a5248446401400df064510 | Python | stankiewiczm/contests | /ProjectEuler/UC solutions/Successful 51-100/Q058.py | UTF-8 | 948 | 2.90625 | 3 | [] | no_license | from Numeric import *;
MAX = 30001; NP = 0; Prime = list();
Prime.append(2); IsP = ones(MAX); IsP[1] = 0;
def Gen():
for i in arange(2,MAX/2):
IsP[2*i] = 0;
n = 3;
NIsP = 1;
while (n < MAX):
if (IsP[n] == 1):
Prime.append(n);
NIs... | true |
f32023a43c593e7d4943e7efb4016ef91e05bb32 | Python | chase001/chase_learning | /Python接口自动化/第10课/api-demo-test/Auto/utils/MyConf.py | UTF-8 | 959 | 2.546875 | 3 | [] | no_license | # -*- coding: utf-8 -*-#
# -------------------------------------------------------------------------------
# Name: Myconf
# Description:
# Author Dongtian
# Date: 2020-01-05
# -------------------------------------------------------------------------------
import configparser
import os
c... | true |
65c8ecc0d67dbaf764ddc3029e8339a762252a20 | Python | BIAOXYZ/variousCodes | /_CodeTopics/LeetCode_contest/biweekly/biweekly2022/70/70_1.py | UTF-8 | 530 | 3.0625 | 3 | [] | no_license | class Solution(object):
def minimumCost(self, cost):
"""
:type cost: List[int]
:rtype: int
"""
cost.sort(reverse=True)
n = len(cost)
if n < 3:
return sum(cost)
noNeedToBuy = 0
for i in range(2, n, 3):
noNeedToBu... | true |
b3a5b04ff31fba2df233f4475de351ac4193288e | Python | acenturione/LPTHW | /ex19_SD3.py | UTF-8 | 1,107 | 4.875 | 5 | [] | no_license | # Learn Python the Hard Way Exercise 19 SD3
def my_function(arg1, arg2):
print "summing arg1: %r and arg2: %r..." % (arg1, arg2)
print arg1 + arg2
print "1. Call function by inserting numbers:"
my_function(4, 44)
print "2. Call funtion by inserting strings:"
my_function('cat', 'dog')
print "3. C... | true |
5ba354eaf4fb6bde0c148928bd8f3c6991abadc5 | Python | DOnghiaGroup/orion_kinematics | /coordinate_conversions.py | UTF-8 | 9,481 | 2.609375 | 3 | [] | no_license | import numpy as np
import pandas as pd
from astropy.coordinates import Angle
from astropy.coordinates.builtin_frames import LSR
from astropy.coordinates import (CartesianRepresentation,CartesianDifferential,CylindricalRepresentation,CylindricalDifferential)
from astropy.coordinates import ICRS, Galactic, GalacticLSR, G... | true |
ebaef33726ace8770e1c6f0bd6fe98b3f3de9f59 | Python | MingduDing/My_codes | /crossin编程教室/ex45.py | UTF-8 | 2,571 | 2.625 | 3 | [] | no_license | from sys import exit
from random import randint
class Scene(object):
def enter(self):
exit(1)
class Engine(object):
def __init__(self, scene_map):
self.scene_map = scene_map
def play(self):
current_scene = self.scene_map.opening_scene()
last_scene = self.scene_map.next_scene('finished')
while curren... | true |
005524ecafbfa1db26d72ee0e09d48a946ec8973 | Python | kolbt/whingdingdilly | /post_proc/gtar_pressure.py | UTF-8 | 4,203 | 2.546875 | 3 | [
"BSD-3-Clause"
] | permissive | # Imports and loading the .gsd file
import sys
hoomd_path = str(sys.argv[4])
gsd_path = str(sys.argv[5])
# need to extract values from filename (pa, pb, xa) for naming
part_perc_a = int(sys.argv[3])
part_frac_a = float(part_perc_a) / 100.0
pe_a = int(sys.argv[1])
pe_b = int(sys.argv[2])
sys.path.append(hoomd_path)
... | true |
02dcbaecdfe99d75147d289b91a725600cbb0035 | Python | WangXueqiong/workspace | /translation/translation.py | UTF-8 | 2,301 | 2.65625 | 3 | [] | no_license | #!/usr/bin/python
# -*- coding:utf8 -*-
from tkinter import *
from tkinter import messagebox
import requests
# 根据用户输入的单词翻译
def translation():
#获取用户输入的单词
content = entry.get()
print(content)
if content == '':
messagebox.showinfo('提示','请输入要翻译的单词')
else:
url = 'http://fanyi.youdao.co... | true |
9aa192325a75fc2761d9a4b919d29d122462ef48 | Python | ShahriyarR/gino-admin | /tests/integration_tests/docker/wait_for.py | UTF-8 | 560 | 2.734375 | 3 | [
"MIT"
] | permissive | #!/usr/bin/python
import asyncio
from time import sleep
from gino import Gino
async def main():
db = Gino()
await db.set_bind("postgresql://gino:gino@postgres:5432/gino")
await db.pop_bind().close()
if __name__ == "__main__":
for _ in range(5):
try:
asyncio.get_event_loop().run_... | true |
17da5d220cd4c130a31ad333c78d3b864a4c3267 | Python | johnniewalker7488/Tiny_Imagenet_Zero_Shot_Classification | /models/DenseNet.py | UTF-8 | 2,738 | 2.515625 | 3 | [] | no_license | import numpy as np
import torch
import torchvision
import torch.nn as nn
class DenseConv(nn.Module):
def __init__(self, in_channels, out_channels):
super(DenseConv, self).__init__()
self.conv = nn.Conv2d(in_channels, out_channels, kernel_size=3, stride=1, padding=1, bias=False)
self.bn = n... | true |
86fca23ed83de92f66063c89eb95c4eda7179d9c | Python | tanvibajpai/fairclustering | /k_center_OPT.py | UTF-8 | 1,338 | 3 | 3 | [] | no_license | from gurobipy import *
from networkx import *
# import math
def k_center(G,k):
model = Model("k_center_OPT")
x = {}
y = {}
n = G.number_of_nodes()
for v in G.nodes(): #should this be replaced by range(n)?
y[v] = model.addVar(vtype=GRB.BINARY, name = "y_%s" % v)
model.addConstr(quic... | true |
ca5d81598339bcb8a7c3bacd649a864d1108a2dd | Python | BornaGhotbi/Medical-Image-Processing | /scripts/make_embeddings.py | UTF-8 | 9,497 | 2.640625 | 3 | [] | no_license | #!/usr/bin/env python3
'''run the model on images json file and produce output
'''
import sys
import argparse
import json
import os
import glob
import cv2
import logging
import tensorflow as tf
import numpy as np
from collections import defaultdict
parser = argparse.ArgumentParser(description=\
... | true |
ac5953399a647183382fd235afa3078fcf3f2cf8 | Python | Pavithralakshmi/corekata | /1.py | UTF-8 | 63 | 2.59375 | 3 | [] | no_license | s1=input("eter anything")
s2=input("enter somthing")
print(s2)
| true |
74970323f64fa211e1838b16ebb9564560efe2f5 | Python | aineko-macx/python | /ch8/8_11.py | UTF-8 | 1,172 | 4.28125 | 4 | [] | no_license | def any_lowercase1(s):
#This function works but cannot handle exceptions
for c in s:
if c.islower():
return True
else:
return False
def any_lowercase2(s):
#Evaluates the char 'c'; output is always true
for c in s:
if 'c'.islower():
return 'Tr... | true |
4ce049bbeee2bf146032789ddcd29ae842d76d5e | Python | hubenjm/crackthecode | /1_8.py | UTF-8 | 173 | 3.34375 | 3 | [] | no_license | def isRotation(s1, s2):
t = s1 + s1
return s2 in t
s1 = "waterbottle"
s2 = "erbottlewat"
print isRotation(s1, s2)
s1 = "hello"
s2 = "ello h"
print isRotation(s1, s2)
| true |
0190752443a5c8dd9cd31be82a9607581f42acb7 | Python | Dearyyyyy/TCG | /data/3920/AC_py/518351.py | UTF-8 | 125 | 3.34375 | 3 | [] | no_license | # coding=utf-8
n = int(input())
a =n%10
b = n%100//10
c =n//100
if n==a**3+b**3+c**3:
print("YES")
else:
print("NO") | true |
23258c5bf8365d46bef7d689a41488ae7046f29d | Python | sportfy/JD-Script | /msg.py | UTF-8 | 3,102 | 3.078125 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python3
# -*- coding: utf-8 -*
'''
项目名称: JD-Script / msg
Author: Curtin
功能:通知服务
Date: 2021/11/7 下午6:46
TG交流 https://t.me/topstyle996
TG频道 https://t.me/TopStyle2021
# 调用方法:
from msg import msg
#启动通知服务
msg().main()
# 发信息 msg打印控制台同时会记录日志在message(),后面统一发送
msg(" Hello ! ")
print(" ... | true |
d445e292e57e1d1124a7a914b39bbe86dfa421de | Python | daqingyi770923/SDCFun | /DWATest.py | UTF-8 | 2,832 | 2.6875 | 3 | [
"MIT"
] | permissive | import math
import matplotlib.pyplot as plt
import numpy as np
import DWAConfig
from pathPlanClass import PPClass
from pathPlanClass import RobotType
# 获取参数文件
CFG = DWAConfig.cfg
# 初始化路径规划对象
ppClass = PPClass(
CFG.PATHPLAN.max_accel, #最大加速度 [m/ss]
CFG.PATHPLAN.min_accel, #最小加速度(允许倒车) [m/ss]
CFG.PATHPLAN.y... | true |
33f6231bf57b0088401594c6aeb8d8445f6432ce | Python | FjDhika/TestChallenges | /largest.py | UTF-8 | 358 | 3.328125 | 3 | [] | no_license | from functools import cmp_to_key
def larg(num1, num2):
if str(num1)+str(num2) < str(num2)+str(num1):
return 1
elif str(num1)+str(num2) == str(num2)+str(num1):
return 0
else:
return -1
def largest(numbers):
x = sorted(numbers, key=cmp_to_key(larg))
x = [str(itm) ... | true |
b2c7fa95e2a7a697427d2cb25553929fb86c2b9d | Python | kenziyuliu/vanilla-nn-python | /optimizers.py | UTF-8 | 3,762 | 3.453125 | 3 | [
"MIT"
] | permissive | import config
import numpy as np
# Little factory method for making optimizers
def get_optimizer(name):
name = name.lower()
if name == 'sgd':
return SGD(config.LEARNING_RATE)
elif name == 'adam':
return Adam(config.LEARNING_RATE)
else:
raise ValueError('Unsupported Optimizer: "... | true |
1eb1b3db37ab7a2d832518a15c94c4602e396a88 | Python | dandubovoy/DPV | /chap1/ex_1_21.py | UTF-8 | 421 | 3.40625 | 3 | [] | no_license | from readint import readinput
from inverse_modulo import inverse_modulo
def checkinverses(n):
count = 0
for i in range(1, n+1):
inv = inverse_modulo(i, n)
if inv is not None:
count += 1
return count
def main():
n = readinput("n value")
count = checkinverses(n)
pri... | true |
04d6298043726dff3b7633ce8c5b3ad33d3884fc | Python | scottkeller/driverreport | /driverreport-pkg/driverreport/tests/test_driver.py | UTF-8 | 4,565 | 3.765625 | 4 | [] | no_license | """
MODULE: test_driver.py
DESCRIPTION: Runs unit tests on the driver module
"""
import unittest
from ..core.driver import Driver
from ..core.trip import Trip
# Constants
TIME_FORMAT = '%H:%M'
class TestDriver(unittest.TestCase):
"""
Unit tests for the driver.Driver class
"""
def setUp(self):
... | true |
b4a7585ad31d6cebacddced8085e2f08f3505ff7 | Python | mleybov/pyWebsiteCode | /deliv.py | UTF-8 | 495 | 2.640625 | 3 | [] | no_license | from selenium import webdriver
print('Input your Schoology email address')
userEmail = input()
print('Input your Schoology password')
userPassword = input()
browser = webdriver.Firefox()
browser.get('http://Schoology.com')
loginElem = browser.find_element_by_id('login-header')
loginElem.click()
emailElem = browser.... | true |
5c37e1afa309937120cfcc4bf0daeffe1532d077 | Python | mukherr/python_repos | /amazon-braket-pennylane-plugin-python-main/src/braket/pennylane_plugin/ops.py | UTF-8 | 8,799 | 2.609375 | 3 | [
"Apache-2.0"
] | permissive | # Copyright Amazon.com Inc. or its affiliates. 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. A copy of
# the License is located at
#
# http://aws.amazon.com/apache2.0/
#
# or in the "license" file a... | true |
6d8edcb8d58b789f6e281617d15c9f020257cc51 | Python | QaziAmmar/ComputerVision | /cnn_base_classifcation_annotaion/update_annotation_for_multiclass.py | UTF-8 | 2,361 | 2.6875 | 3 | [] | no_license | # // Created by Qazi Ammar Arshad on 09/07/2020.
# // Copyright © 2020 Qazi Ammar Arshad. All rights reserved.
"""
We have separate the red blood cell according to their life cycle stage manually. This code read each cell form it
folder and update the annotation files accordingly.
"""
import os
import json
from cust... | true |
e63513740c0e2ca6e7d2ba5079eb68ee9238db90 | Python | UCMHSProgramming16-17/final-project-Nikodem-K | /graphs.py | UTF-8 | 578 | 3.828125 | 4 | [] | no_license | # I will be making two graphs on crime in the US
# import pandas and name it "pd" to be able to use the necessary functions
import pandas as pd
# import the desired chart types, output file, and the save function using bokeh
from bokeh.charts import Bar, output_file, save, Scatter
# assign a variable to your data
dat... | true |
4913718ec8400099cc0817f6cef09a9811ae176c | Python | AdrianoCavalcante/exercicios-python | /Lista_exercicios/ex085.py | UTF-8 | 351 | 4.1875 | 4 | [] | no_license | numeros = [[], []]
for c in range(1, 8):
num = int(input(f'Digite o {c}º valor: '))
if num % 2 == 0:
numeros[0].append(num)
else:
numeros[1].append(num)
print('-=' * 30)
numeros[0].sort()
numeros[1].sort()
print(f'Os números pares digitados foram {numeros[0]}')
print(f'Os números impares dig... | true |
7c61f1256518477f37cf07761b68523e066dc831 | Python | xwjsarah/spark_app | /customer-order.py | UTF-8 | 537 | 2.640625 | 3 | [] | no_license | from pyspark import SparkConf, SparkContext
conf = SparkConf().setMaster("local").setAppName("customer-order")
sc = SparkContext(conf = conf)
def parseLine(line):
fields = line.split(',')
id = fields[0]
cost = float(fields[2])
return (id, cost)
lines = sc.textFile("c:///SparkCourse/customer-orders.c... | true |
180a1034ffe37a3330c4afb9221e7201b73fd7be | Python | dkern27/CollegeProgramming | /Python/Epics2IntegrationComparison/randSpike.py | UTF-8 | 332 | 3.59375 | 4 | [] | no_license | '''
Dylan Kern
Generates a random spike of noise in the range of -5 to 5
'''
import random as r
def randomSpike(noise, points):
'''
Generates random spike of noise
'''
place=r.randint(0,points) #chooses random spot to place spike in
noise[place]=r.randrange(-5,5) #Generates random spike at place
... | true |
fdca166154196871e437590b6a957512fcb51d67 | Python | yanzastro/healpix_profiles | /signal_measure_class.py | UTF-8 | 17,181 | 2.828125 | 3 | [] | no_license | # This file defines classes needed to measure signal and profiles
# from Healpix maps at given source catalogs.
# The most important inputs are positions and a healpix map.
import healpy as hp
import numpy as np
class signal_profile:
def __init__(self, skymap, mask, pos_src_all, fwhm):
self.skymap = sky... | true |
a18cdbce0b1c797d6058b955c218625287fcc176 | Python | aloksinghal/tautology-verifier | /statement_solver.py | UTF-8 | 998 | 3.234375 | 3 | [] | no_license | from utils import get_variables, truth_combos, replace_variables
from utils import replace_negation, create_postfix, evaluate_postfix
def check_tautology(input_string):
is_tautology = True
input_string = input_string.replace(" ", "")
variables = get_variables(input_string) # get list of distinct variable... | true |
22a10e98806f15b07ba0d619394a243b58d7f826 | Python | jamiethezim/Nagios-collection | /pipe.py | UTF-8 | 542 | 2.71875 | 3 | [] | no_license | #!/Users/jamiezimmerman/anaconda/bin/python
import argparse
def ok(n, m):
res = "SNMP OK - PDU Phase1 Load Percent: 64 | 'PDU Phase1 Load Percent:'=64"
print(res)
#print(n, m)
if __name__=='__main__':
import argparse
parser= argparse.ArgumentParser(description='get the args')
parser.add_argument('-l', '--locatio... | true |
d77761dacc441967bd6b24b54d4b01eb5af264c6 | Python | WeianBO/ACM-ZZUOJ | /ACM.py/1036.py | UTF-8 | 350 | 3.03125 | 3 | [] | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
__author__ = 'GonnaZero'
a = input().split()
b1 = [1, 3, 5, 7, 8, 10, 12]
b2 = [4, 6, 9, 11]
a1 = int(a[0])
a2 = int(a[1])
if a2 in b1:
print(31)
elif a2 in b2:
print(30)
else:
if (a1%100 ==0 and a1%400 == 0) or (a1%100 != 0 and a1%4 == 0):
print(29)
... | true |
d8f97a2db328b41f5a697e7331fe1f7847166904 | Python | quzhengpeng/pydw | /pydw/utils/connection.py | UTF-8 | 2,547 | 2.765625 | 3 | [
"Apache-2.0"
] | permissive | import pymysql
class Config:
def __init__(self, type, host, port, username, password, database, encoding):
self.type = type
self.host = host
self.port = port
self.username = username
self.password = password
self.database = database
self.encoding = encoding
... | true |
c0f0a1bdc1540e9f2ea0ca8f2d4e46c1f331081d | Python | paalso/hse_python_course | /5/5-29.py | UTF-8 | 1,007 | 3.625 | 4 | [] | no_license | # https://www.coursera.org/learn/python-osnovy-programmirovaniya/programming/U8U1d/blizhaishieie-chislo
# Ближайшее число
# В первой строке задается одно натуральное число N, не превосходящее 1000 –
# размер массива. Во второй строке содержатся N чисел – элементы массива (целые
# числа, не превосходящие по моду... | true |
4bc57eb0e7e928fd3cc60aebe9cd008826470977 | Python | mechnotech/foodgram-project | /recipes/management/commands/add_tags.py | UTF-8 | 825 | 2.6875 | 3 | [] | no_license | import csv
from django.core.management.base import BaseCommand
from recipes.models import Tag
class Command(BaseCommand):
help = 'Добавить список тэгов в базу (цвет и наименование)'
def handle(self, *args, **options):
with open('recipes/presets/tags.csv',
'r',
en... | true |
d5c7d26cf0e2332fbee70b9ace1d5faf6ffc4da6 | Python | jamezou/streamers-project | /streamers-app.py | UTF-8 | 12,558 | 3.40625 | 3 | [] | no_license |
# import libraries
import pandas as pd
import streamlit as st
import matplotlib.pyplot as plt
import seaborn as sns
sns.set_style("darkgrid")
sns.set_palette("deep")
# load dataset
df = pd.read_csv("twitch-streamers.csv")
def home():
st.title("Top Twitch Streamers")
st.markdown("From June 10th, 2020 through... | true |
0123256e05ae363764037de8d7c1abf85a4860ae | Python | toosngaan/git_practice | /hello.py | UTF-8 | 296 | 3.1875 | 3 | [] | no_license | #code to practice git
name = input('what is your name?')
print(f'hello there, {name}!')
print('my name is Computer :) ')
location = input('So, where are you from?')
print(f'Oh I have never been to {location} before!')
print("Hi Lesia, this is your klone!")
print("More klones are comming!!!")
| true |
2602842a4a555ed76753839d645964afebd0e619 | Python | uk-ar/competitive_programming | /aoj/grl_3_b.py | UTF-8 | 1,464 | 2.53125 | 3 | [] | no_license | #!/usr/bin/env python3
# N,M = map(int,sys.stdin.readline().split())
# a = tuple(map(int,sys.stdin.readline().split())) # single line with multi param
# a = tuple(int(sys.stdin.readline()) for _ in range(N)) # multi line with single param
# a = tuple(tuple(map(int,sys.stdin.readline().rstrip().split())) for _ in range(... | true |
dd83636e233bf998328eda1ddfdffa61159d1838 | Python | mappingvermont/dc-fire-stations | /geocode.py | UTF-8 | 897 | 2.640625 | 3 | [
"Apache-2.0"
] | permissive | import os
import csv
import geojson
from geopy import geocoders
src_csv = r'/home/charlie/Proj-16/dc-fire-stations/source.csv'
out_geojson = os.path.join(os.path.dirname(src_csv), 'stations.geojson')
g = geocoders.GoogleV3()
with open(src_csv) as theCSV:
csv_reader = csv.reader(theCSV)
feat_list = []
# grab hea... | true |
192c2a3b4dc1ecab6ed531d24b8e31bccea47b79 | Python | andresafanador2/Inicial | /EJERCICIOS PYTHON/#codigo python.py | UTF-8 | 49 | 2.59375 | 3 | [] | no_license | #codigo python
x = "2022"
print ( "Hola Mintic " + x) | true |
7995d10c4aacc60155d2bd45437be62a2bf3e681 | Python | humford/ProjectEulerSolutions | /Other/Python2.7/Problem81.py | UTF-8 | 341 | 2.875 | 3 | [] | no_license | exampleMatrix = [ [131, 673, 234, 103, 18], [201, 96, 342, 965, 150], [630, 803, 746, 422, 111], [537, 699, 497, 121, 956], [805, 732, 524, 37, 331] ]
matrix = open('/Users/henrywilliams/Documents/p081_matrix.txt', 'r')
def shortestPathBruteForce(m):
paths = []
m[0][0]
def shortestPath(m):
pass
print sum(shortes... | true |
b170b4d6da7e0c94ee3fec1999f8943fdbcf05f8 | Python | wally-wally/TIL | /00_startcamp/03_day/list_prob_05.py | UTF-8 | 489 | 4.03125 | 4 | [] | no_license | '''
문제 5.
표준 입력으로 물품 가격 여러 개가 문자열 한 줄로 입력되고, 각 가격은 ;(세미콜론)으로 구분되어 있습니다.
입력된 가격을 높은 가격순으로 출력하는 프로그램을 만드세요.
# 입력 예시: 300000;20000;10000
'''
prices = input('물품 가격을 입력하세요: ')
# 아래에 코드를 작성해 주세요.
price1, price2, price3 = map(int, prices.split(';'))
print(sorted({price1, price2, price3},reverse=True)) | true |
419a16eceafda1306c643f071ac1fb74784e9e7f | Python | ilovepilav/Binary-Search-Tree-Pyhton | /BinarySearchTree.py | UTF-8 | 4,831 | 3.625 | 4 | [] | no_license | from Node import Node
class BinarySearchTree:
def __init__(self):
self.root = None
def insert(self, value):
new_node = Node(value)
if self.root is None:
self.root = new_node
return
n = self.root
while n is not None:
if value > n.valu... | true |
4974e6af8f4daa71abd668b35b3230cbd6f8696d | Python | jungeunlee95/python-crawler | /__main__.py | UTF-8 | 6,112 | 2.515625 | 3 | [] | no_license | import os
import ssl
import sys
import time
from builtins import list, tuple
from datetime import datetime
from itertools import count
from urllib.request import Request, urlopen
# import pandas as pd
from bs4 import BeautifulSoup
from selenium import webdriver
from collection import crawler
def get_html(url):
... | true |
d4cde14cabf782a24595c041387a879b41ba56af | Python | sand-ki/scrapy-tempaltes | /scrapy_templates/spiders/custom_crawler.py | UTF-8 | 1,778 | 2.703125 | 3 | [] | no_license | from scrapy.spiders import CrawlSpider, Rule
from scrapy.linkextractors import LinkExtractor
import datetime as dt
import logging
from ..items import ProductItem
from ..config import iamge_path
class ProductCrawler(CrawlSpider):
name = "custom_crawler1"
allowed_domains = ["test.com"]
start_urls = ["test.c... | true |
0c57e39466f7d9fdc50032d6af79af22c1e3b329 | Python | daniel-reich/ubiquitous-fiesta | /XXJbGFEkrMWCp8yFn_16.py | UTF-8 | 72 | 2.703125 | 3 | [] | no_license |
def give_me_something(a):
result = "something " + a
return result
| true |
43f7ee2fc88cb8fcfd93f2768883d88ae7603ddf | Python | idve/starmaker | /AirtestCase/case/PerformanceTesting/confusion_substitution.py | UTF-8 | 479 | 2.515625 | 3 | [] | no_license | # coding=utf-8
import os
import sys
def confusion_substitution():
py_files_list = []
file_path = sys.path[0]
file_list = os.listdir(file_path)
# 获取文件list
for i in file_list:
if i[:7] == "solopi_":
files = os.path.join(file_path, i)
py_files_path = os.path.join(files... | true |
a2bf7c3869c252f084341093ffcb7fda1f51dde5 | Python | freeshyam/lc | /541_reverse_string_II.py | UTF-8 | 1,560 | 3.421875 | 3 | [] | no_license | #!/usr/bin/env python3
import unittest
class Solution(object):
def reverseStr(self, s, k):
"""
:type s: str
:type k: int
:rtype: str
"""
l = list(s)
length = len(s)
max_i = length - 1
twok = 2 * k
curr = 0
r = curr + twok - 1... | true |
d719bcd1c588d9a19da6de4f47f5397295425d5e | Python | levimdmiller/ReedSolomon | /python_prototype/main.py | UTF-8 | 1,438 | 2.546875 | 3 | [] | no_license | from interpolate import *
from model.poly import Polynomial
import numpy as np
from ff_factory import B4
from functools import reduce
import operator
FFT = Psi(B4, 4, B4(0))
Polynomial.set_psi(FFT)
f = Polynomial(np.array([B4(15), B4(12), B4(3), B4(6)]))
evals = FFT.transform(f.coeffs, f.msb, normalized=True)
print(... | true |
8ba40f98dd8b8f2e8175d93761af80a697db885c | Python | xnkjdxyql/PythonRepository | /ThreadTest/ThreadTest.py | UTF-8 | 1,111 | 3.46875 | 3 | [] | no_license | import threading
import time
total = 4
lock = threading.Lock()
def create_item_1():
global total
for i in range(10):
time.sleep(1)
with lock:
total += 1
print("creator_1 add item to {}".format(total))
print("Creator_1 FINISHED JOB")
def create_item_2():
globa... | true |
a0d6a5842deb7b149dfaa387196a9f76c2799846 | Python | larsks/flocx-market | /flocx_market/matcher.py | UTF-8 | 2,073 | 3.078125 | 3 | [] | no_license | import jmespath
import re
def apply_operator(val1, val2, op):
if val1 is None or val2 is None or op is None:
return False
# null operator
if op == 'null':
return val1
neg = False
ret_val = False
if op.startswith('!'):
neg = True
op = op[1:]
if op == ... | true |
d4f1760d96b3273e755d52d52cd739bf5fd19458 | Python | motazsaad/campain-title-gen | /utility_code/NER/other_lib/geopy_NER.py | UTF-8 | 343 | 3.0625 | 3 | [
"Apache-2.0"
] | permissive | from geopy.geocoders import Nominatim
geolocator = Nominatim()
location = geolocator.geocode("175 5th Avenue NYC")
print(location.address)
# print(location.country)
# Flatiron Building, 175, 5th Avenue, Flatiron, New York, NYC, New York, ...
print((location.latitude, location.longitude))
# (40.7410861, -73.98962972416... | true |
2ce7e77888b9561011264de95666ccab9f09b02c | Python | wangyongfei0306/Data-structure-and-algorithm | /Object_Oriented_programming/oop2.py | UTF-8 | 1,027 | 4 | 4 | [] | no_license | class Programmer:
wang = 'WANG'
def __init__(self, name, age, weight):
self.name = name
self._age = age
self.__weight = weight
@classmethod
def get_wang(cls):
return cls.wang
@property
def get_weight(self):
return self.__weight
def self_introductio... | true |
ee3ec2ff77decde6f2c9ab7fd3f7b774a11319b0 | Python | cmontalvo251/Microcontrollers | /Circuit_Playground/CircuitPython/libraries/adafruit-circuitpython-bundle-6.x-mpy-20211013/examples/seesaw_analogin_test.py | UTF-8 | 711 | 2.90625 | 3 | [] | no_license | # SPDX-FileCopyrightText: 2021 ladyada for Adafruit Industries
# SPDX-License-Identifier: MIT
# Simple seesaw test reading analog value
# on SAMD09, analog in can be pins 2, 3, or 4
# on Attiny8x7, analog in can be pins 0, 1, 2, 3, 6, 7, 18, 19, 20
#
# See the seesaw Learn Guide for wiring details:
# https://l... | true |
43d25552106508aa3ff9f94894ac4ecd358c5a2f | Python | martinsutherland1/Test_task_pda | /specs/card_game_tests.py | UTF-8 | 1,257 | 3.34375 | 3 | [] | no_license | import unittest
from src.card import Card
from src.card_game import CardGame
class TestCardGame(unittest.TestCase):
def setUp(self):
card1 = Card("Hearts", 1)
card2 = Card("Clubs", 5)
self.card_game = CardGame(card1, card2)
def test_game_has_cards(self):
cards = None
... | true |
24748b3c0a2a8fc8c49efb4e1d7ec77d7e97c8c6 | Python | vivek247703/Expense-Manager- | /AdminPage.py | UTF-8 | 7,520 | 2.640625 | 3 | [] | no_license | # Dashboard
from tkinter import ttk
from NewExpense import *
from NewIncome import *
class AdminPage:
def __init__(self, root, color, font, dbconnection, width, current_login):
for child in root.winfo_children():
child.destroy()
self.root = root
self.dbconnection = dbconnec... | true |
2ab4768db374aaf701ae0ae04b15cab141df2ba6 | Python | georgosgeorgos/AI-ML | /ML/regression/wine/lib_wine_regression.py | UTF-8 | 1,467 | 3.1875 | 3 | [
"MIT"
] | permissive | import numpy as np
import matplotlib.pyplot as plt
def inner(X, theta):
prod = (X * theta).sum()
return prod
def h_function(X, theta):
m, p = X.shape
h = np.zeros((m,))
for i in range(m):
h[i] = inner(X[i, :], theta)
return h
def Cost(X, theta, y):
J = (h_function(X, the... | true |
3f6b64a516003eb579638d99c41e2fca6266d4a4 | Python | SaniyaWani/project99 | /Atm.py | UTF-8 | 490 | 2.515625 | 3 | [] | no_license | class Atm (object):
def _init_(self, debit_card_nos, pinNumber):
self.debit_card_nos = debit_card_nos
self.pinNumber = pinNumber
def cashWithdrawl(self, amountOfWithdrawlMoney):
self.amountOfWithdrawlMoney=amountOfWithdrawlMoney
print(self.amountOfWithdrawl... | true |
01fe0ef7ecf744980bcc266bfb89f9c5ecc853b7 | Python | atpy/atpy | /atpy/latextable.py | UTF-8 | 520 | 2.796875 | 3 | [
"MIT"
] | permissive | from __future__ import print_function, division
class LaTeXTable(object):
def latex_write(self, filename):
# Open file for writing
f = open(filename, 'wb')
for i in range(self.__len__()):
line = ""
for j, name in enumerate(self.names):
if j > 0:... | true |