blob_id stringlengths 40 40 | content_id stringlengths 40 40 | repo_name stringlengths 5 114 | path stringlengths 5 318 | language stringclasses 5
values | extension stringclasses 12
values | length_bytes int64 200 200k | license_type stringclasses 2
values | content stringlengths 143 200k |
|---|---|---|---|---|---|---|---|---|
dfa2ce36e8e54fde9338b2a9e66ca75459bfb8d9 | 08a7b1cedc0ff29f46edf6ce5d2e8c89b2c56007 | kanglang860515/sqlalchemy | /lib/sqlalchemy/testing/requirements.py | Python | py | 22,938 | permissive | # testing/requirements.py
# Copyright (C) 2005-2017 the SQLAlchemy authors and contributors
# <see AUTHORS file>
#
# This module is part of SQLAlchemy and is released under
# the MIT License: http://www.opensource.org/licenses/mit-license.php
"""Global database feature support policy.
Provides decorators to mark test... |
bf606e3c613700cd3d13750d077309473bcb73ad | 01dba7a94e639f639437c971b3df9fcc891e5146 | JamesChung821/python | /stanCode_Projects3/Assignment5 - Boggle Game Solver/largest_digit.py | Python | py | 1,023 | permissive | """
File: largest_digit.py
Name: James Chung
This program is to find the largest digit
----------------------------------
This file recursively prints the biggest digit in
5 different integers, 12345, 281, 6, -111, -9453
If your implementation is correct, you should see
5, 8, 6, 1, 9 on Console.
"""
def main():
"""
... |
fb7c88cd30621a385c4fcc4b7da14ae8b54cd657 | 7fc48a05b14480619a0fe0ec1d427a1d24a956e3 | HiPyLiv/HiPyProject | /PurePy 4. Defining Our Own Functions/geometry.py | Python | py | 932 | no_license | import math
def area_of_circle(radius):
return math.pi * radius**2
def area_of_triangle(sideA, sideB, angle=90):
'''
Takes two sides of a triangle and the angle
between them (measured in degrees).
Returns area of triangle.
If no angle is given, is equivalent to
base * height / 2
'''
... |
ca64a01e9d4c822d815b202514076d1d05e8eac4 | 1350f26383689a1349e4e63be4ca100d9046ec38 | salspaugh/smapsplunking | /smapsplunkerd.py | Python | py | 2,055 | no_license | #!/usr/bin/env python
from smap.archiver.client import *
import daemon
import json
import lockfile
import logging
import logging.config
import signal
class SmapSplunkingLogger:
QUERYURL = "http://ar1.openbms.org:8079"
DATA = "Metadata/Extra/Phase = 'ABC' and \
Properties/UnitofMeasure = 'kW'... |
e8b83751f93355b5e0b2a295fb083bcd16a869c4 | 4d59c81188118d902da6316c06ef884d15a7bab1 | hojihun5516/object-detection-level2-cv-02 | /template/mmdetection/mmdet/models/detectors/two_stage.py | Python | py | 7,008 | permissive | # Copyright (c) OpenMMLab. All rights reserved.
import warnings
import torch
from ..builder import DETECTORS, build_backbone, build_head, build_neck
from .base import BaseDetector
@DETECTORS.register_module()
class TwoStageDetector(BaseDetector):
"""Base class for two-stage detectors.
Two-stage detectors t... |
8669c0b01f328fd3303f5a034fe3e1fd7360f380 | 529e6615dd6518e16da5ba15bbaf5d464046a5d0 | PARKNAYEON/WebServer | /python/generator.py | Python | py | 4,238 | no_license | # 흐름제어, 병행처리(Concurrency)
# 파이썬 반복형 종류
# for, collections, text file, List, Dict, Set, Tuple, unpacking, *args
# 반복형 객체 내부적으로 iter 함수 내용, 제네레이터 동작 원리, yield from
# 반복 가능한 이유? -> iter(x) 함수 호출
t = 'ABCDEF'
# for 사용
for c in t:
print('Ex1-1 -', c)
print()
#while
w = iter(t)
while True:
try:
print(... |
8d00fa7a4c3c5e8a6d05a7d316b2cd69e0074583 | ce6e9f99b5c0e6ce34ad4484544e7e46f3d7f501 | pqmzla1029/packaginghelper | /container_packing/space.py | Python | py | 5,353 | no_license | from typing import Union
from .dimension import Dimension
class Space(Dimension):
def __init__(self, parent_or_name_or_w=None, name_or_w: Union[str, int]=None, w: int=None, d: int=None, h: int=None,
x: int=None, y: int=None, z: int=None):
if parent_or_name_or_w is None and name_or_w is ... |
87b8059f24acd1e9f416675c6ef7c119c04025b6 | 825a62370f84ae87809ae08f9921caa846a4b12c | SilverRuler/LicensePlate_OCR | /backend/keras_yolo3/a/easyocr/setup.py | Python | py | 1,047 | permissive |
# -*- coding: utf-8 -*-
from setuptools import setup
from io import open
with open('requirements.txt', encoding="utf-8-sig") as f:
requirements = f.readlines()
def readme():
with open('README.md', encoding="utf-8-sig") as f:
README = f.read()
return README
setup(
name='easyocr',
packages... |
38bc15151cbee8a666c8870427af747e3db1455a | b3c785ef23c5977954842d3cf4e8948fffd35ac6 | herohunfer/leet | /18.py | Python | py | 2,529 | no_license |
def fourSum(self, nums, target):
def findNsum(l, r, target, N, result, results):
if r-l+1 < N or N < 2 or target < nums[l]*N or target > nums[r]*N: # early termination
return
if N == 2: # two pointers solve sorted 2-sum problem
while l < r:
s = nums[l] + num... |
b9e0993383d1b37a3dfa9bc917c8cbaf7c3e5d21 | 08f6949f6f0e8f5a4287ab4574be85033220556e | amankhandelia/datasets | /src/datasets/search.py | Python | py | 30,461 | permissive | import importlib.util
import os
import tempfile
from pathlib import PurePath
from typing import TYPE_CHECKING, Dict, List, NamedTuple, Optional, Union
import numpy as np
from . import utils
from .utils import logging
if TYPE_CHECKING:
from .arrow_dataset import Dataset # noqa: F401
try:
from elast... |
537752610df996f93eb0eda1f3e6d3a282f2156a | 4652d2f5385ccc8394156d98c93b21e666c5cede | Electro01/Electro | /spider_main.py | Python | py | 1,970 | no_license | # -*- coding: utf-8 -*
from Baike_Spider import url_manager, html_downloader, html_parser,\
html_outputer # 创建各个class并引入
class SpiderMain():
def __init__(self): # 初始化各个对象( 爬虫总调度程序会使用 url 管理器、 html 的下载器、解析器、输出器)
self.urls=url_manager.UrlManager()
self.downloader = html_downloade... |
1a9cecf09a44642f97a0e836aa071bc449db3009 | 1b298d6153e6a68d84471dd9e64f146466cf25b8 | anikom95/LPTHW | /EX26/ex26.py | Python | py | 2,302 | no_license | def break_words(stuff):
"""This function will break up words for us."""
words = stuff.split(' ')
return words
def sort_words(words):
"""Sorts the words."""
return sorted(words)
def print_first_word(words)
"""Prints the first word after popping it off."""
word = words.pop(0)
print word
... |
3b824185c287b214273b49ae3e9a37d045667100 | 0d02a369dca15a54bc9a4e315b3bcac3d50bb52d | dr-dos-ok/Code_Jam_Webscraper | /solutions_python/Problem_159/689.py | Python | py | 1,972 | no_license | """
Created on Apr 17, 2015
@author: umnik700@gmail.com
"""
# INPUT_FILE = 'test-input.txt'
# OUTPUT_FILE = 'test-output.txt'
# INPUT_FILE = 'A-small-attempt0.in'
# OUTPUT_FILE = 'A-small-attempt0.out'
INPUT_FILE = 'A-large.in'
OUTPUT_FILE = 'A-large.out'
total_tests = None
tests = []
def process_test(intervals,... |
c697ed85efa2a963847bf37c9ab7f07ef8995cea | c40622833f3e7f06a9908e83a9e496a37b1e2384 | jlboat/BayesASE | /hpc/ase_scripts/mclib_Python/gff.py | Python | py | 12,600 | permissive | import os.path
from collections import defaultdict
import logging
import gffutils
class _Anno(object):
""" General class for handling annotation database created from GFFUtils
Arguments:
filename (str) = filename of your gff/gtf file
filetype {'gff', 'gtf'} = file extension
force (bool) = if ... |
ded8379916d300acb19d6a0d658a1404282a3f9c | b94e1be128e41666b33ee2e8b41d6daae1658edb | LennyBoyatzis/compsci | /tests/test_inflight_entertainment.py | Python | py | 1,153 | no_license | import unittest
from problems.inflight_entertainment import can_two_movies_fill_flight
class Test(unittest.TestCase):
def test_short_flight(self):
result = can_two_movies_fill_flight([2, 4], 1)
self.assertFalse(result)
def test_long_flight(self):
result = can_two_movies_fill_flight([... |
79bbfd96f5d0e5010f8aa310b0bccd3fe52a9eea | 9b0dde7fad659fce07d96c644d1beef7fc202e4d | mrfrosty0430/WaveGoogle | /svm_v2.py | Python | py | 5,518 | no_license | from matplotlib import pyplot as plt
from sklearn.datasets import load_iris
from sklearn.externals import joblib
from sklearn.svm import SVC
import torch
import os
import copy
import numpy as np
import random
import csv
from torch import nn
import torch.nn.functional as F
from torchvision import datasets, transforms
im... |
7710563229a34bb0e7b2f6beaa9f27dac86d6c9f | 6fe3048b29edd71439509443a645720d40795705 | vixiaoan/cloudteam | /20101124/oecn_so_2_po/partner.py | Python | py | 750 | no_license | # -*- encoding: utf-8 -*-
##############################################################################
#
# Created on 2010-11-24
# @author: stbrine@yahoo.com.cn
#
##############################################################################
from osv import fields, osv
from tools.translate import _
... |
bd023064b8a64fd518312106e0731a615b8aeed5 | d085c46bd6420f5e913f79b9a1a83f8b1fc433d6 | akimrx/space-engineers-exporter | /se_exporter/client/prometheus.py | Python | py | 6,390 | permissive | #!/usr/bin/env python3
"""This module contains SpaceEngineersCollector and SpaceEngineersExporter classes."""
import logging
import time
from se_exporter.client.vrage import VRageAPI
from se_exporter.models.base import Base
from prometheus_client import Summary, start_wsgi_server
from prometheus_client.core import RE... |
c2b3ffd97e1d8bf891695c40190b65fe67761b1c | 99892abc7e1c33338188a439770bac8c7b3ae448 | mhgharieb/Speed_up_MILP_with_Matsui | /SIMON/SIMON32/SIMON1/SIMON_SK.py | Python | py | 2,233 | no_license | from CryptoMIP import *
n = 16 # word size (one branch)
S_T_3XOR = [(1, -1, 1, 1, 0), \
(-1, -1, 1, -1, 2), \
(-1, -1, -1, 1, 2), \
(-1, 1, -1, -1, 2), \
(-1, 1, 1, 1, 0), \
(1, -1, -1, -1, 2), \
(1, 1, 1, -1, 0), \
(1, 1, -1, 1, 0)] # Constraints template for a xor b xor c = d
class SIMON(Cipher):
def g... |
83dc0eed5046a2f5bfbbbd01c38bbe98ddd8712f | 201b34ed4101bbf5c63ba9100af95bcb603e9751 | fanzou2020/Parsing | /oldVersion/Client.py | Python | py | 624 | no_license | from oldVersion import GenerateTruthTable as gtb, Parsing as ps
# Question 1
sentence_list = ps.open_txt("input.txt")
var_dic = ps.open_json("variables.json")
print("====== Question 1 ======")
for s in sentence_list:
print(s+" ", end='')
print("= ", end='')
print(ps.parsing(sentence_list, var_dic))
print("========... |
ad02a11523629aac7024451ff97cc350f5fa075f | 210ead528712672d4eee2be4c93d1fd2a4b76fc6 | sashreek1/Ciphey | /ciphey/basemods/Crackers/ascii_shift.py | Python | py | 4,006 | permissive | """
██████╗██╗██████╗ ██╗ ██╗███████╗██╗ ██╗
██╔════╝██║██╔══██╗██║ ██║██╔════╝╚██╗ ██╔╝
██║ ██║██████╔╝███████║█████╗ ╚████╔╝
██║ ██║██╔═══╝ ██╔══██║██╔══╝ ╚██╔╝
╚██████╗██║██║ ██║ ██║███████╗ ██║
© Brandon Skerritt
Github: brandonskerritt
"""
from typing import Optional, Dict, Union, Set, Li... |
3c62e961d15cc87aefc2b65d0a00356d0ab5f539 | 2daeaf44062fa3ccf06058d0b6f50fc34806a0f3 | Submitty/Submitty | /migration/migrator/migrations/course/20210907230249_add_poll_student_histogram_setting.py | Python | py | 1,132 | permissive | """Migration for a given Submitty course database."""
def up(config, database, semester, course):
"""
Run up migration.
:param config: Object holding configuration details about Submitty
:type config: migrator.config.Config
:param database: Object for interacting with given database for environme... |
7734fd391adb02decb12830b265139e1d8a4c48f | 8c85419817c0c5593231135b77e98cba4dbeeb26 | BenWGee/EP408CompPhysics | /Week1/plotSin.py | Python | py | 668 | no_license | # -*- coding: utf-8 -*-
"""
Created on Thu Sep 26 14:46:58 2019
@author: bguilfoyle github.com/bengfoyle
Overview: Exercise 1.5 - 1.8 Plot f(x) = sin(x) for 0 <= x <= 2 Pi
"""
import numpy as np
import matplotlib.pyplot as plt
def makePlot(xAxis,yAxis):
plt.plot(xAxis,yAxis,"g--",label = "sin(x)")
plt.title(... |
2726f1ce414383308303dbce2f7c51544f93a9b4 | 1c5d2b6d889dd220be9b59d011c0dc3d0ad94236 | larsbutler/oq-platform | /oq-ui-api/geonode/isc_viewer/models.py | Python | py | 2,147 | no_license | from django.contrib.gis.db import models
# date, lat, lon, smajaz, sminax, strike, depth, unc , mw, unc , s, mo, fac, auth , mpp , mpr , mrr , mrt , mtp , mtt
class Measure(models.Model):
src_id = models.IntegerField(null=False, blank=False, default=-1)
date = models.DateTimeField(null=False, blank... |
e5ed77eda7e50a0c8b3bd7cc6a2cf37b9e796157 | b3df05f0a438df2816365df347b0ff4d6e3614db | ecurtin2/Project-Euler | /src/318.py | Python | py | 1,006 | no_license | """
Consider the real number √2+√3.
When we calculate the even powers of √2+√3
we get:
(√2+√3)2 = 9.898979485566356...
(√2+√3)4 = 97.98979485566356...
(√2+√3)6 = 969.998969071069263...
(√2+√3)8 = 9601.99989585502907...
(√2+√3)10 = 95049.999989479221...
(√2+√3)12 = 940897.9999989371855...
(√2+√3)14 = 9313929.999999892... |
8d65a612ec4764412d9a3e68f3a835a230042544 | 5369d998a6220f8930f185a36aee89b89346f101 | SindhuVempati/hangman | /hangman/views.py | Python | py | 3,839 | no_license | from django.shortcuts import render, redirect, get_object_or_404
from django.contrib.auth.decorators import login_required
from django.contrib.auth.models import User
from . models import Hangman
from django.db import transaction
import random
from datetime import datetime
from random import choice
import log... |
00cfde1cd4e9bdf6f54d5c372b03b4895c319310 | afeaf06bf3edb8046f224dd9d8f975621aa88708 | pickles976/TwoLlamas | /RunAlgo.py | Python | py | 3,422 | no_license | import alpaca_trade_api as tradeapi
import requests
import matplotlib.pyplot as mpl
import numpy as np
import statsStuff as stats
# Replace these with your API connection info from the dashboard
base_url = 'https://paper-api.alpaca.markets'
api_key_id = ''
api_secret = ''
api = tradeapi.REST(
base_url=base_url,
... |
ce16b03363520dd06a788b9fc8d6e153c4ca30d9 | 70d194af6571363ad57f9e733ed1ef4cdf525e39 | steptan/indy-plenum | /plenum/test/node_catchup/test_node_request_missing_transactions.py | Python | py | 3,233 | permissive | import types
import pytest
from plenum.common.constants import DOMAIN_LEDGER_ID
from stp_core.common.log import getlogger
from plenum.common.messages.node_messages import CatchupReq
from plenum.test.helper import sendRandomRequests
from plenum.test.node_catchup.helper import waitNodeDataEquality
from plenum.test.test... |
ef9448f6d6d7e690f24fc43b317ab91028810141 | 07960e82a1cba1ac793c9cb6eb867295dd0795cd | manish-mishr/POSTagger | /label.py | Python | py | 1,619 | no_license | ###################################
# CS B551 Fall 2015, Assignment #5
# D. Crandall
#
# There should be no need to modify this file, although you
# can if you really want. Edit pos_solver.py instead!
#
from pos_scorer import Score
from pos_solver import Solver
import sys
# Read in training or test data file
#
def r... |
be75312ebe8803d6b8188b98df8a9c7605087fc8 | d287e756b939c42245473beadb684d8f501d9ad5 | huangzhiuyun/learning_log | /manage.py | Python | py | 545 | no_license | #!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "learning_log1.settings")
try:
from django.core.management import execute_from_command_line
except ImportError as exc:
raise ImportError(
"Couldn't import Django... |
dd464b3d4974473cbff903e90d9cd9fb440caa9b | f253ac8ba23fbd18b2bb85ec7f3c64a287075c95 | aisk/redis-shard | /examples/config.py | Python | py | 468 | no_license | #!/usr/bin/env python
# -*- coding: utf-8 -*-
servers = [
{'name':'server1','host':'127.0.0.1','port':6379,'db':0},
{'name':'server2','host':'127.0.0.1','port':6379,'db':0},
{'name':'server3','host':'127.0.0.1','port':6379,'db':0},
{'name':'server4','host':'127.0.0.1','port':6379,'db':0}... |
61fcd10eef123a93b574619e0814a20d2509f5e0 | a3910d159db16033f9238966c9bcf0c821e206d8 | kaxil/airflow | /airflow/providers/jenkins/hooks/jenkins.py | Python | py | 1,931 | permissive | #
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not... |
7360068b215fd6815716ff2754eb80e7a25ad2a3 | dfa62ca6d1310370fbbc2ffe7648f551ff180112 | atsuhiro/dagster | /examples/dagster_examples_tests/tutorial_tests/test_expectations.py | Python | py | 1,238 | permissive | import pytest
from dagster import DagsterExpectationFailedError, execute_pipeline, RunConfig
from dagster_examples.intro_tutorial.expectations import expectations_tutorial_pipeline
def test_intro_tutorial_expectations_step_one():
result = execute_pipeline(
expectations_tutorial_pipeline,
{
... |
bb536e0413107a5ba827c686172a243398c91f6b | 6ff992478f22e174d152db446f7bbe365cd353f0 | leezqcst/neural-art-transfer | /losses.py | Python | py | 2,430 | no_license | import numpy as np
import tensorflow as tf
def content_loss(cont_out, target_out, layer, content_weight):
'''
# content loss is just the mean square error between the outputs of a given layer
# in the content image and the target image
'''
cont_loss = tf.reduce_sum(tf.square(tf.sub(target_o... |
6354dc4510960280c7a8f0a5834ae66b10d04969 | bcaa9aa7c4d3f86a87c5e25fc4ac969bfa37e341 | jsr5194/project_euler_scripts | /python/problem14.py | Python | py | 554 | no_license | #!/usr/bin/python
def get_next_term(last_term):
term = 0
if last_term % 2 == 0:
term = last_term/2
else:
term = 3 * last_term + 1
return term
def main():
start = 0
max_chain_length = 0
for i in xrange(1, 1000000):
cur_chain_length = 0
last = i
while True:
cur_chain_length += 1
next_term = get... |
3464847ad108c5b7df887fffe1bf3bd9ca6c9a9a | b02af5ca1a33eaea84cebf8f89d49349b8d8e6e2 | skyrookie/Readium-WebKit | /Tools/Scripts/webkitpy/layout_tests/port/chromium_mac_unittest.py | Python | py | 6,114 | no_license | # Copyright (C) 2010 Google Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the f... |
fddc2e9bb3b3bb227d22b06494f4523e4bb454e3 | df1924ec6b364d6b92397a37fa1051c59bf4afa6 | rivforthesesh/aoc-2020 | /16b.py | Python | py | 6,290 | no_license | # input
with open('16.txt', 'r') as file:
input = file.read()
# reading in tickets
input_list = list(input.split('\n'))
# start iterating over lines
line_no = 0
line = input_list[line_no]
# get the rules as a list of dicts
rules = []
while len(line) > 0: # before the blank line
# departure loca... |
c2b75f6eb6768ddaf18626b27a1f267fea5afab4 | 6a13ff7f12d081c1dcd761aac735386e495293d3 | moroznoeytpo/adventofcode | /y_2017/d_5/run_2.py | Python | py | 445 | no_license | values = []
with open('y_2017/d_5/input.txt', 'r') as file:
for line in file:
if line:
values.append(int(line))
position = 0
step = 0
while(True):
try:
current_value = values[position]
if current_value < 3:
values[position] += 1
else:
values[... |
e979a758bdf88f03a1b8906ecc52ebe215a1bcab | 28a91526dc9261b8591e9909aea8b07e635e2744 | ilearnProgramme/HinetPy | /tests/test_utils.py | Python | py | 2,051 | permissive | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from datetime import datetime
import pytest
from HinetPy.utils import split_integer, point_inside_box, haversine, \
point_inside_circular, string2datetime
class TestUtilsClass:
def test_split_integer(self):
assert split_integer(16, 4) == [4, 4, 4, 4]
... |
912fc942d0c10b821eee2c3159c1709b8356c112 | 95133936fdb215e469ad3491b025ef9fcd46650d | sarielsaz/sarielsaz | /test/functional/httpbasics.py | Python | py | 4,793 | permissive | #!/usr/bin/env python3
# Copyright (c) 2014-2016 The Sarielsaz Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Test the RPC HTTP basics."""
from test_framework.test_framework import SarielsazTestFramework
from t... |
77d6565cca5aa99881f85769ca8d7c4936208d35 | 68752e80595840f1c9363c4b423c2009f805da28 | patsonev/Python_Basics_Exam_Preparation | /cruise_ship.py | Python | py | 885 | no_license | kind_cruise = input()
kind_cabin = input()
nights = int(input())
if kind_cabin == 'standard cabin':
if kind_cruise == 'Mediterranean':
price = 27.5
elif kind_cruise == 'Adriatic':
price = 22.99
elif kind_cruise == 'Aegean':
price = 23
elif kind_cabin == 'cabin with balcon... |
33873bf7902cb63922348c6c38fd1d75fb9669f7 | 4b85eace9b685e1a000cccdad077236ea89063e1 | ogrisel/scikit-learn | /examples/preprocessing/plot_scaling_importance.py | Python | py | 9,836 | permissive | """
=============================
Importance of Feature Scaling
=============================
Feature scaling through standardization, also called Z-score normalization, is
an important preprocessing step for many machine learning algorithms. It
involves rescaling each feature such that it has a standard deviation of ... |
b7145feda426f0f1914eace30e5292ac8ce56a30 | 443b4cbd191d69c4505fae37e7d5e67d7c585978 | hAbd0u/PUPIL-Detection-using-OpenCV | /detect_pupil.py | Python | py | 2,167 | permissive | # -*- coding: utf-8 -*-
"""
Created on Sat Aug 3 12:46:13 2019
IDE : Anaconda (Spyder)
@author: LALIT ARORA
"""
import cv2
import os
import numpy as np
from pprint import pprint
# directory that holds eyes images to find and detect the purpil
eyes_dir = "Eye Images"
class pupil_detection():
de... |
59855e026e98fd8964df737b394cb2d9f8485339 | 2670742a1e29558377d510557884bfcdf7050863 | DishaJindal/FairRaceDetection | /attention.py | Python | py | 6,441 | no_license | import pandas as pd
import numpy as np
import os, shutil
from tqdm import tqdm
import sys
from imageio import imread
import matplotlib.pyplot as plt
from matplotlib.patches import Rectangle
from itertools import chain
import itertools
import logging
import warnings
from torch.nn import Sigmoid
from torch import Tenso... |
0fb38aa04f8e9f2aeb4c53f59175891d793e3d46 | 4e2a29f2c6b03066dd8f055d7730c6e4e0616770 | marcos982/freqtrade | /user_data/strategies/fixed_riskreward_loss.py | Python | py | 4,926 | no_license | # pragma pylint: disable=missing-docstring, invalid-name, pointless-string-statement
# isort: skip_file
# --- Do not remove these libs ---
import numpy as np # noqa
import pandas as pd # noqa
from pandas import DataFrame
from freqtrade.strategy.interface import IStrategy
# --------------------------------
# Add you... |
fe70c4293f011aa8165de7edb51c4d798ed80b66 | ea7dab18e95b307c2db9e50459ffaf2ff643dd82 | myungwooko/algorithm | /_pramp/200108/array_of_array_products_mine.py | Python | py | 2,514 | no_license | """
Array of Array Products
Given an array of integers arr, you’re asked to calculate for each index i the product of all integers except the integer at that index (i.e. except arr[i]). Implement a function arrayOfArrayProducts that takes an array of integers and returns an array of the products.
Solve without using d... |
4a2dfe7a9e4810f5b207f271102f855b05275a3d | 1f5eafc88b91d3f9be8ba735305ac6a0b84cef58 | anas-didi95/cheapr-fyp | /backend/price/migrations/0005_auto_20180428_2034.py | Python | py | 724 | no_license | # Generated by Django 2.0.4 on 2018-04-28 20:34
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('price', '0004_auto_20180428_2031'),
]
operations = [
migrations.AlterField(
model_name='price',... |
8e847a2639ea35d429c2079c98e9e3b7034c3600 | 83f3731b64c3b33b8ba1c9146dee7aeef191ad08 | McCoyGroup/McUtils | /McUtils/Jupyter/JHTML/WidgetTools.py | Python | py | 2,792 | permissive |
__all__ = [
"JupyterAPIs",
"DefaultOutputArea"
]
class JupyterAPIs:
"""
Provides access to the various Jupyter APIs
"""
_apis = None
@classmethod
def load_api(cls):
try:
import IPython.core.interactiveshell as shell
except ImportError:
shell = N... |
8a451a5d14c2dfe3f597fda4cd2160d50e82312f | e31e57b01b1f1399e82ddcd5990e7a331854082a | Kashish-2001/blog-clone-project | /blog project/mysite/blog/models.py | Python | py | 1,316 | no_license | from django.db import models
from django.utils import timezone
from django.urls import reverse
# Create your models here.
class Post(models.Model):
author = models.ForeignKey('auth.User', on_delete=models.CASCADE)
title = models.CharField(max_length = 200)
text = models.TextField()
create_date = model... |
335a43a0294401f5ab1cb5266a1b86e6314835b5 | 06ede685cdf7464043ad6e6a67b63f862697c651 | 4ions/holbertonschool-higher_level_programming | /0x08-python-more_classes/1-rectangle.py | Python | py | 1,018 | no_license | #!/usr/bin/python3
""" Module of rectangle """
class Rectangle():
""" Class of rectangle """
def __init__(self, width=0, height=0):
""" instantiation of rectangle """
self.width = width
self.height = height
@property
def height(self):
""" Return the height """
... |
c4f9e4f2ddba5bcf0fa85eae6adda10ae40ccb66 | 22a0dc75e84f672711a680ea81131bbd0e0b340c | jdolivet/ISN-Cours | /Cours 2019/08-09-AlgorithmePGCD.py | Python | py | 246 | no_license | """
Created on 05-15-2019
@author: Johann Dolivet
Calcul du PGCD de a et b
Algorithme d'Euclide
Fonction dans sa version itérative
"""
def pgcd(a, b):
r = a % b
while r != 0:
a = b
b = r
r = a % b
return b
|
a496e91a753ea3e3a25be422334284e909fc63b0 | c8a501898226bed931050883b15281401fffd79f | ideasrule/ceres | /cafe/cafeutils.py | Python | py | 8,123 | permissive | from __future__ import print_function
import matplotlib
matplotlib.use("Agg")
from astropy.io import fits as pyfits
import numpy as np
import scipy
import copy
import glob
import os
import matplotlib.pyplot as plt
import sys
from pylab import *
base = "../"
sys.path.append(base+"utils/GLOBALutils")
import GLOBALutils
... |
0f51092e76c6842ffd2a025bde9776e96928e341 | 8a979bca8d6c76a3cce39fa4cff8d9e4f1b33df2 | dupeljan/nncf | /tests/torch/test_models/shufflenet.py | Python | py | 4,004 | permissive | """
Copyright (c) 2019 Intel Corporation
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writin... |
21086fb9130e5e6fe7c74f46beb0224b21f34f33 | 0229a91453545da2b5c6a249eadb5a7ab9c0e9fe | urlteam/The_python_code | /python_Dragonfly/test.py | Python | py | 682 | no_license | from dragonfly.all import Grammar, CompoundRule
# Voice command rule combining spoken form and recognition processing.
class ExampleRule(CompoundRule):
spec = "do something computer" # Spoken form of command.
def _process_recognition(self, node, extras): # Callback when command is spoken.
... |
1b7280fc6c671ce8e17b3854a2c36425c7f678b6 | 10349265812ec0755bea7cadb8ff5b7ba1bbd9a5 | Temmmo/python_study_scraping | /scraping/scraping1.py | Python | py | 600 | no_license | import re
from common import download
from bs4 import BeautifulSoup
url ='http://example.webscraping.com/places/default/view/Armenia-12'
html =download(url)
print re.findall('<tr id="places_area__row"><td class=["\']w2p_fl["\']><label class="readonly" for="places_area" id="places_area__label">Area: </label></td><td cla... |
c80d81ec47e7262bab614832256db8bdfb5f9753 | 13df84d4ee5d3100de8ef65187a82a23abac2552 | glottolog/pyglottolog | /src/pyglottolog/references/bibfiles_db.py | Python | py | 40,802 | permissive | """Load references from .bib files into sqlite3, hash, assign ids (split/merge)."""
import collections
import contextlib
import difflib
import functools
import itertools
import logging
import operator
import pathlib
import typing
from clldutils import jsonlib
from csvw import dsv
import sqlalchemy as sa
import sqlalc... |
0f14df4720a2663ae13d09d9c7ea509a8f374187 | c43fd8142dd9985f3ef7a8fe8291c2b7da648ec7 | funningboy/scrapy_giant | /notify/gmail/gmail.py | Python | py | 9,173 | no_license |
import logging
import multiprocessing
import multiprocessing.queues
import os.path
import smtplib
import time
from email.utils import formatdate,make_msgid,getaddresses,parseaddr
from smtplib import SMTPResponseException,SMTPServerDisconnected,SMTPAuthenticationError
from message import Message
class GMail(object):... |
6a2546bc2eaf6238feb8d7a2337578ac826fbba8 | f9d9635c7cda29c4043451d007a914d19bba13e7 | mikkelnrasmussen/Fagprojekt-gruppe-14 | /run_pep2score.py | Python | py | 2,615 | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Tue Nov 10 16:38:38 2020
@author: mikkel
"""
import os
import subprocess
os.chdir("/Users/mikkel/Desktop/netMHCpan-4.1/pep2score")
# Function calling the pep2score program (executable file) in the terminal
# and outputs the results in txt files for alle ... |
b62b36c608aa3aaa4003e9cec85875865cf4bc77 | 6df55821b427cd81464d59019d09414b003d0630 | xinghuZhou/huhu | /Dd.py | Python | py | 307 | no_license | class Dd:
def __init__(self,name):
print('初始化方法')
self.name=name
def eat(self):
print("%s爱吃骨头汤"%self.name)
tom=Dd('tom')
tom.eat()
jack=Dd('jack')
jack.eat()
|
3a8697e5fc43ef23fdf0aba5311b7b37ce607c7d | cf6e46d4fddabeeeeaab3a99d45b725d2e0dceb9 | Paul-C3/Group_project | /django_blog/settings.py | Python | py | 3,566 | no_license | """
Django settings for django_blog project.
Generated by 'django-admin startproject' using Django 2.2.
For more information on this file, see
https://docs.djangoproject.com/en/2.2/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/2.2/ref/settings/
"""
import os
... |
bf2dc41c8307eab9d229d973d54cab0e61aa7c43 | c7d2dd14fa2e06a9dbe329d3ce03c044bc0470a0 | cqbomb/qytang_aci | /lib/python2.7/site-packages/acimodel-1.3_2j-py2.7.egg/cobra/modelimpl/uribv4/db.py | Python | py | 4,247 | no_license | # coding=UTF-8
# **********************************************************************
# Copyright (c) 2013-2016 Cisco Systems, Inc. All rights reserved
# written by zen warriors, do not modify!
# **********************************************************************
from cobra.mit.meta import ClassMeta
from cobra.m... |
0f183d2e9d6db2501f2201b426475e0781628bc7 | 22f35af5bbc8b28d5c6b8993addb5eb9d29e30c8 | ryomakawata/matching | /match/migrations/0007_auto_20200702_2011.py | Python | py | 3,127 | no_license | # Generated by Django 2.1.5 on 2020-07-02 11:11
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('match', '0006_auto_20200701_1658'),
]
operations = [
migrations.RemoveField(
model_name='skill',
name='target',
... |
189eb8475124ef2404b4c2ea60983cb46d829612 | 5eb4c6a321f9f2023d21e4e948f3fce4161e708f | miguelzetina/FBDownloAndPosting | /upload_video_to_fb.py | Python | py | 704 | no_license | import os
import requests
import json
import datetime
FB_ACCESS_TOKEN = os.getenv('FB_ACCESS_TOKEN')
FB_PAGE_ID = os.getenv('FB_PAGE_ID')
def upload_video(title):
print("Start upload video: ", datetime.datetime.now())
fburl = 'https://graph-video.facebook.com/v10.0/{0}/videos?access_token={1}'.format(
... |
9b5c2a861b9d10258e812333832c8733b4264ba6 | 74740f9295915e08338e9d6157b6809d67b21862 | hoperunChen/pythonlearn | /test005.py | Python | py | 635 | no_license | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# The second day tuple类型
print u'另一种有序列表叫元组:tuple。tuple和list非常类似,但是tuple一旦初始化就不能修改'
print u'声明方式:mytuple = (e1,e2)'
mytuple = ('e1','e2')
print mytuple
print u'声明只有一个元素的tuple时,要在第一个元素后面添加逗号,打印时也会显示逗号'
mytuple1 = ('e1',)
print mytuple1
print u'tuple可以嵌套list,tuple中的list可... |
c5eed5e407cf988e31ed445a4afa9723a7ab6b11 | 10434b77ba71ae87cebab9a295a4ca02d5fd2bf9 | MthokoNdlela/starsocial | /groups/migrations/0004_auto_20210108_0729.py | Python | py | 849 | no_license | # Generated by Django 3.1.3 on 2021-01-08 07:29
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
('groups', '0003_auto_2020... |
a6fca59b5e5b5702b5ea75d301728eaac08cd387 | b10193bdd34c4cf437be135cb0dd71d540c30aa4 | Wbeaching/python_data | /3.正课/7.25/7.练习.py | Python | py | 666 | no_license | from http.cookiejar import CookieJar,LWPCookieJar
from urllib.request import Request,urlopen,HTTPCookieProcessor,build_opener
from urllib.parse import urlencode
# 生成一个管理cookie的对象
cookie_obj=CookieJar()
# 创建一个支持cookie的对象,对象属于HTTPCookiePrecssor
cookie_handler = HTTPCookieProcessor(cookie_obj)
# build_opener内部的实现就是urlopen... |
609e9587c333bf5f558ec4b9fd6b8c12b209bff7 | 6fa7a6db88abd701e670b1f5db1f368b932c5713 | anishsunkara/django-deployment-example | /learning_templates/learning_templates/urls.py | Python | py | 981 | no_license | """learning_templates URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.10/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: url(r'^$', views.home, name='home... |
69a9deca1f5ba077ab29ee35e4d353c3d2800ff5 | 912b8542f40005948b5fbced6f58b898925c7674 | pombredanne/busitizer | /busitizer/settings.py | Python | py | 7,815 | permissive |
import os
SITE_ROOT = os.path.dirname(os.path.dirname(os.path.realpath(__file__)))
DEBUG = True
TEMPLATE_DEBUG = DEBUG
ADMINS = (
# ('Your Name', 'your_email@example.com'),
)
MANAGERS = ADMINS
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3', # Add 'postgresql_psycopg2', 'mysql', '... |
bd5f0a450a39a46a1478c7d534c243dd5885fb01 | c9acbf9ca89ad3e1b4ec4838298a4092d4f69fae | leonhostetler/grad-projects | /numerical-diff-eq/02_odes/full-example1.py | Python | py | 6,661 | no_license | #! /usr/bin/env python
"""
This script implements a finite difference approximation for the solution u(x) of
the differential equation u'' = f(x), with boundary conditions u(0) = u(1) = 0. In
this case, we are given that f(x) = -pi^2*sin(pi*x). The exact solution, to be used
for comparison, is u(x) = sin(pi*x).
Here, ... |
56eb272ab7490bf7963aff077b212f2175a240ff | 464351fd64b01f3daac1d78e0633e7e2caa2a33a | ssarfraz/pose-sensitive-embedding | /nets/inception_v4_views.py | Python | py | 16,368 | no_license | # Copyright 2016 The TensorFlow 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 applicable ... |
95fdaa0185fde818330212a330c8bf0c536c7677 | a8f1ebd80e0f798faaf9dc6d508b2b6308a46c8e | haydenm2/autonomous_systems_algorithms | /extended_information_filter/eif_test.py | Python | py | 7,065 | no_license | #!/usr/bin/env python3
from eif import EIF
from quad import Quad
import numpy as np
import matplotlib.pyplot as plt
from matplotlib.patches import Circle
# ------------------------------------------------------------------
# Summary:
# Example of implementation of ekf class on a simple Two-Wheeled Robot system defined... |
d66d3aa2e5c9823bfe34234634fa051753b9a2b6 | b3022833cbc4e0413e0d9f301e44ef882aeb90eb | fcharmy/face | /attendence/attend_server/urls.py | Python | py | 1,849 | permissive | from . import views
from . import ivle_views
from . import attend_views
from django.conf.urls import url
app_name = 'attend'
urlpatterns = [
url(r'^$', views.index, name='index'),
url(r'^form_update_module', views.update_module_form, name='update_module'),
url(r'^form_detect', views.detection, name='detec... |
ce8ba188d3b1eb966e8d5e50eae9b0fb8291f643 | fa74985713436577e05e12d86db645d45830d031 | dimassantoso/super-sanic | /src/v1/model/expeditions.py | Python | py | 817 | no_license | import sqlalchemy
metadata = sqlalchemy.MetaData()
expeditions = sqlalchemy.Table(
'bc_expedition',
metadata,
sqlalchemy.Column('id', sqlalchemy.Integer, primary_key=True),
sqlalchemy.Column('available_for', sqlalchemy.String(length=100), nullable=True),
sqlalchemy.Column('code', sqlalchemy.Strin... |
4ddbb9dfabef1d1cf2efb163c61237842a608937 | 85b5d356997ea16aea29ac90ce484c856f55d14d | Themaister/Granite | /tools/sweep_stat_analysis.py | Python | py | 5,623 | permissive | #!/usr/bin/env python3
import sys
import os
import argparse
import json
import copy
def read_stat_file(path):
with open(path, 'r') as f:
json_data = f.read()
parsed = json.loads(json_data)
return parsed
def default_value(key):
if key == 'pcf_width':
return 1
else:
... |
68a4dacbf79183888da63b4eac4b595482528b1d | d78af4cab074fc1704a11b7fe7611de564fd1209 | irfanhanfi/raspberry-pi-stilas | /stilas/stilas.py | Python | py | 5,674 | no_license | import webbrowser, os, sys, shutil, glob, time, zipfile, subprocess, configparser
# import shutil
# import glob
# import time
# import zipfile
try:
import httplib
except:
import http.client as httplib
def have_internet():
conn = httplib.HTTPConnection("www.google.com", timeout=5)
try:
conn.req... |
4eeec445c5cc8a1a6fa4930d317165ba711e7caa | 2697f90ad0011169e8c97846f6568e8f3b33a488 | huongnt-2545/django_tutorial | /catalog/forms.py | Python | py | 1,550 | no_license | from django import forms
from django.core.exceptions import ValidationError
from django.utils.translation import ugettext_lazy as _
import datetime
from .models import BookInstance
class RenewBookForm(forms.Form):
renewal_date = forms.DateField(
help_text="Enter a date beetwen now and 4 weeks, default ... |
eb651284cd596bd146f4f2809d844a26019db248 | a0e64911fe47ea62003972a20ae99df1a59cbc62 | Schulingkamp/Swaymun_Invasion | /bullet.py | Python | py | 949 | no_license | import pygame
from pygame.sprite import Sprite
class Bullet(Sprite):
'''A class that manages bullets fired from the ship.'''
def __init__(self, ai_game):
'''Create a bullet object at the ship's current position.'''
super().__init__()
self.screen = ai_game.screen
self.settings = ai_game.settings
self.colo... |
817e5b0a931879a4d5f701b7564aa67f9a75b40a | 1b2a026510be9dcda576c4add999afcbd9ad94eb | RybaSG/NTTC | /demux_modules/qam16.py | Python | py | 1,790 | no_license | import scipy.io as sci
import numpy as np
import math
class QAM16:
nStreams = 8
nMod = 4
nFrames = 100
rate16200 = (7, 1, 4, 2, 5, 3, 6, 0)
rate64000 = (0, 5, 1, 2, 4, 7, 3, 6)
rates = {
"16200": rate16200,
"64800": rate64000,
}
def __init__(self, input_path, output_p... |
82a2457530a9fbe8b53a444ee06fa15d8de12f28 | 36b463e6793faab38bdc4223e597cecf270275e9 | ned21/aquilon | /lib/aquilon/worker/commands/show_permission_role.py | Python | py | 1,238 | permissive | # -*- cpy-indent-level: 4; indent-tabs-mode: nil -*-
# ex: set expandtab softtabstop=4 shiftwidth=4:
#
# Copyright (C) 2008,2009,2010,2011,2013,2014,2016,2018 Contributor
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obt... |
7821acd4df9479339a174218960e58de750cd958 | 55c5dc1967d73d88e8ff4ae4f9bf3f47bec0c9ff | mbelcen/EmailExplorer | /statisitcs.py | Python | py | 8,376 | no_license | import pandas as pd
from ast import literal_eval
import matplotlib.pyplot as plt
pd.set_option('display.max_rows', 500)
pd.set_option('display.max_columns', 500)
pd.set_option('display.width', 1000)
"""
This script contains multiple functions that provides various information contained in an email data set about the ... |
9e7834466cbd886c85404da100cb0ecd0302f6ae | de473ac8594d2528068b5a82f91545f94c5ff067 | SAVE-group2/HWDL_ht | /hw1.py | Python | py | 3,082 | no_license | # deep learning / artifical neural network by 2blam
# import the libraries
import numpy as np
import pandas as pd
BASE_DIR = 'drive/2018_save_program/DL/Datatoupload/Artificial Neural Networks(ANN)/Churn_Modelling.csv'
# import data
dataset = pd.read_csv('%s' % BASE_DIR)
X = dataset.iloc[:, 3:13].values #column in... |
0177b4e3d29ea2aaeda16b4ad9d893469942b9d7 | 134ed868a2e307621719496c7f2f5105f453ae2d | farwaali8434/SmartOMeter_v1 | /SmartOMeter_v1/wsgi.py | Python | py | 405 | no_license | """
WSGI config for SmartOMeter_v1 project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/2.1/howto/deployment/wsgi/
"""
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault('DJANG... |
334b478011dbca0b865f19983188aa2800e5b711 | 8abccfba6811b3f4c4a840fa0f47e2bb361e474d | jgjefersonluis/pjar | /venv/Scripts/static-script.py | Python | py | 1,056 | no_license | #!c:\jeferson_senac2021\projetofinal\jgjefersonluis\testesdesenvolvimentoprojetofinalaar\pjdar\venv\scripts\python.exe
# EASY-INSTALL-ENTRY-SCRIPT: 'static3==0.7.0','console_scripts','static'
import re
import sys
# for compatibility with easy_install; see #2198
__requires__ = 'static3==0.7.0'
try:
from importlib.... |
b89b842533f336efd7f2c9a18aebb922d2662092 | fcf4c9c212d9df7588894c86e15f47b1066058c6 | jaredmpeterson/kwplcsw | /kwplcsw/settings.py | Python | py | 3,170 | no_license | """
Django settings for kwplcsw project.
Generated by 'django-admin startproject' using Django 1.11.13.
For more information on this file, see
https://docs.djangoproject.com/en/1.11/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.11/ref/settings/
"""
import o... |
cec6b4a3aedfcfdc47fc3185a82b21a0323c3390 | 22d9c1c0cae3ac21957d16f15e02b43d24fe05bd | shreyaskamath22/sample_code | /zeeva_addons/zeeva_ind_account_taxes/zeeva_ind_accounts_taxes.py | Python | py | 31,701 | no_license | # -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU... |
68298cfbc0354025a012cb80254de282e9eaace7 | f3719c2f0d6ca2ea7a6aa7a29961c44aa4186fe5 | speedify/speedify-py | /docs/conf.py | Python | py | 5,708 | permissive | # -*- coding: utf-8 -*-
#
# Configuration file for the Sphinx documentation builder.
#
# This file does only contain a selection of the most common options. For a
# full list see the documentation:
# http://www.sphinx-doc.org/en/master/config
# -- Path setup ------------------------------------------------------------... |
6ad8691a326ea7f2f7e96a3f9a1317495e8dbc5e | 8bb0b530580204f90c78df94d23d7cc19c3e0430 | BradleyDB/django_blog_demo | /blog_proj/mysite/mysite/urls.py | Python | py | 1,038 | no_license | """mysite URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/3.0/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: path('', views.home, name='home')
Class-based ... |
cea5d6d338b93bb6dfda7f2c3c3f694d74bc7633 | 8dee98f9b40e36a8e74bc87644dae560cce8541e | Farhanm312/kelas_PBO | /Tugas_1.py | Python | py | 297 | no_license | class student:
def __init__(self,n,a,j):
self.full_name = n
self.age = a
self.job = j
def get_age(self):
return self.age
def job(self):
return self.job
f = student("farhan",19,"Mahasiswa")
print(f.full_name)
print(f.get_age())
print(f.job) |
55b5e1661eee5041186d38a85cb9f1e4b3c8e60d | 7d0ae5d9d50e66fc1e77b5a468cfcb82ab22cb16 | Penguin-Marsfield/Phoenix | /etg/grid.py | Python | py | 23,318 | no_license | #---------------------------------------------------------------------------
# Name: etg/grid.py
# Author: Robin Dunn
#
# Created: 20-Dec-2012
# Copyright: (c) 2012-2018 by Total Control Software
# License: wxWindows License
#------------------------------------------------------------------------... |
120a6fb67b75b250c2bed4f2f6e185764658cebf | 5cd7ab58f0445b09b0ce9ec4b8f420b1ddea7361 | maksimok93/Dp-189 | /elementary_02/elementary_02.py | Python | py | 2,241 | no_license | """
The program determines whether the envelope (with 'a' and 'b' side)
can be inserted into another envelope (with 'c' and 'd' side).
After each calculation, the program asks the user if he wants to continue.
"""
def check_correct_input():
"""Checking user input of positive numbers."""
a = input("Enter the 1... |
0cd2d1ef93b5c0f09c87285b2dd082ab6fb1764f | a3d787741cdc6bc2321618e802372a40bdd9e6fe | NizarKardosh/pythoncourse2020 | /day2.py | Python | py | 2,929 | no_license | from datetime import datetime
# define an empty list
items = []
prices = []
cart = []
def extactDataFromFile():
# open file and read the content in a list
with open('list.txt', 'r') as filehandle:
for line in filehandle:
# remove linebreak which is the last character of the string... |
676d3cd80a7c5cf0dc980df8cc2e4661c61f8a16 | dd8771891afb926ff4024482be26a98f47c561d1 | 7loops/zaposlim.se | /modules/website/apps/search/tasks/process.py | Python | py | 6,013 | no_license | # -*- coding: utf-8 -*-
from website.apps.common.models import Data, DataBackup
from website.apps.common.fields import JSONEncoder
from website.apps.search.models import City
from website.apps.search.mapping import mapping
from celery.task import Task
from celery.registry import tasks
from django.core.seri... |
5220ae02a5fa2537fd99882cbebecb22447ce7cd | 6dab79ab9b9addc2966e4ae77641eb71c512bef9 | HsuhuiChan/text_classify | /utils/lele/layers/layers.py | Python | py | 40,101 | no_license | #!/usr/bin/env python3
# Copyright 2018-present, HKUST-KnowComp.
# All rights reserved.
#
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
"""Definitions of model layers/NN modules"""
import torch
import torch.nn as nn
import torch.nn.fun... |
7d5441c774084779fb1c88c7fc6682beaf1977f1 | e3b77d2d39f22c31b24d801ee2b89d15968eedf3 | overide/project-blog | /mysite/blog/admin.py | Python | py | 744 | no_license | from django.contrib import admin
from .models import Post, Comment
class PostAdmin(admin.ModelAdmin):
list_display = ('title','slug','author','publish','status')
list_filter = ('status','publish','created','author')
search_fields = ('title','body')
raw_id_fields = ('author',)
prepopulated_fields = {'slug':('title... |
a3bf3b9bc59dea86412f53efbd1ac5557ea342f1 | d1bb6680df09ced3c00e502a9ab0a69a973ea0c3 | shabnamparsa-stemcell/RoboSep-STest | /Server/tesla/types/__init__.py | Python | py | 660 | no_license | #
# __init__.py
# tesla.types.__init__.py
#
# Package for types used in the Tesla instrument control software and
# possibly shared (via the interface) with clients
#
# Copyright (c) Invetech Pty Ltd, 2004
# 495 Blackburn Rd
# Mt Waverley, Vic, Australia.
# Phone (+61 3) 9211 7700
# Fax (+61 3) 9211 7701
#
# The ... |
9bc28282f2f17c1f02291427d805c663d09b0638 | 7a59a1168f6134d6aa781bcb9cb225ff405c799e | akashvshroff/Puzzles_Challenges | /meeting_sorting.py | Python | py | 649 | no_license | def meeting(s):
# your code
"""
Take in a string with a list of names - convert to upper case and then sort
by last name, if last name is first then sort by first name.
"""
res = ''
s = s.upper()
names = s.split(';')
names_list = []
for name in names:
first, last = name.s... |
1cdacdb8ba17385e2a6da89a8c5b743bc157f186 | a74908cb40344abe4eb720687af38bf2915a5576 | sanketmarkan/InviteandReferSystem | /inviterefer/urls.py | Python | py | 727 | no_license | from django.conf.urls import url, include
from inviterefer import views
from rest_framework.routers import DefaultRouter
# Create a router and register our viewsets with it.
router = DefaultRouter()
router.register(r'organistation', views.OrganisationViewSet)
router.register(r'extendedusers', views.ExtendedUserViewSet... |
5d5f2897a1bbba52624f0551c093cca78ea8e97a | 186875bb92c1ae2edda3dd2990e8ee2c5c34949b | xhsuj/todo_list | /todoapp/migrations/versions/1d67de549396_.py | Python | py | 853 | no_license | """empty message
Revision ID: 1d67de549396
Revises: 3d825607f22e
Create Date: 2021-08-02 08:59:52.068403
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '1d67de549396'
down_revision = '3d825607f22e'
branch_labels = None
depends_on = None
def upgrade():
# ... |
50f7c5ba10f569921b301032babeb0a0e21b2177 | 10e2dac12541dac027537b6a916db8bb01d99d86 | cchenyixuan/In-time-OpenGL | /console.py | Python | py | 2,991 | no_license | import re
import traceback
class Console:
def __init__(self):
print("This is a Interactive Python Console.")
print("\n")
self.code = """"""
self.times = 1
pass
def fetch_input(self):
raw_code = []
tab = 0
line = 0
while True:
... |
b2cfbcc79f0be9a2e3b465bece041519c3aba925 | a7b058c95567f39b67f807342530be54f24e5414 | watermelon-lee/leetcode | /code/3.无重复字符的最长子串.py | Python | py | 593 | no_license | """
@File : 3.无重复字符的最长子串.py
@Time : 2019-4-12 14:17
@Author : 李浩然
@Software: PyCharm
"""
class Solution:
def lengthOfLongestSubstring(self, s: str) -> int:
ans=0
count=0
words=""
for c in s:
if c not in words:
words+=c
count+=1
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.