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 |
|---|---|---|---|---|---|---|---|---|
7f3cc37430a5d7b488568980bfa9e2710128fd90 | 74faf3267566121add865e231f349b7a475d627c | gchhablani/financial-sentiment-analysis | /preprocess_data.py | Python | py | 1,730 | permissive | import numpy as np
import pandas as pd
from sklearn.model_selection import train_test_split
# TO-DO: Column Renaming, NaN Handling, Normalizing/Scaling, Label Encoding
def convert_columns_to_labels(x):
neg_words = eval(x[1]["Negative"])
pos_words = eval(x[1]["Positive"])
# POS
if neg_words == [] and ... |
89a3623ea46043971b7c6130df99df6cdef6fccc | e34cb16a458a62e2e5ec1b09779727fee87cd220 | UCLA-SEAL/QDiff | /data/p2DJ/New/program/qiskit/QC/startQiskit_QC172.py | Python | py | 3,166 | permissive | # qubit number=2
# total number=11
import cirq
import qiskit
from qiskit import IBMQ
from qiskit import QuantumCircuit, QuantumRegister, ClassicalRegister
from qiskit import BasicAer, execute, transpile
from pprint import pprint
from qiskit.test.mock import FakeVigo
from math import log2,floor, sqrt, pi
import numpy a... |
c7ca33a76aba8b0f03be5f48a56affd13252485b | b2cffd3b6ea64706a1016922f1268d4c7314fdca | 3152gs/Practice_Problems | /Codes/Count'Co_e'.py | Python | py | 398 | no_license | '''Return the number of times that the string "code" appears anywhere in the given string, except we'll accept any letter for the 'd', so "cope" and "cooe" count.
count_code('aaacodebbb') → 1
count_code('codexxcode') → 2
count_code('cozexxcope') → 2
'''
a = 'cozexxcope'
count=0
for i in range(0, len(a)-3):
if (a[... |
e4ebc5a07b64aad99d2aa082d79ddf0723aabbbc | bd9eb0bbdcb4e333dd5762a69073506dcb9b90b8 | kendalvictor/codeando | /Arcpy Taller/Script/ListFeatureClasses.py | Python | py | 280 | no_license | import arcpy
arcpy.env.overwriteOutput=True
arcpy.env.workspace = r"D:\Geotaller\GDB\Practica.gdb"
listaEntidades=arcpy.ListFeatureClasses()
for lista in listaEntidades:
lista2=arcpy.Describe(lista)
print lista2.name + "\t" + lista2.Shapetype
print "Script completado" |
fbcf9ea249240097b52404b41878c30ce1e243ba | 1b051e7c4a99ba955d800bdbf7a16656297e17c5 | tkxkd0159/torch | /ECE643/kurl/kurl/mc.py | Python | py | 2,275 | no_license | import numpy as np
from copy import deepcopy
from kurl.envs.grid import Grid
class MC:
def __init__(self):
self.thresh = 1e-4
self.gamma = 0.9
self.possible_actions = ('U', 'D', 'L', 'R')
self.myenv = Grid.penalty_grid()
self.states = self.myenv.all_states()
self.... |
cd2ceade0819e4e4ecad73568ab060420cb69179 | 3d50d6d3d89836b1e0d25d51a66580606bf52edb | payush/ayush-crowdbotics-61 | /home/management/commands/load_initial_data.py | Python | py | 723 | no_license |
from django.core.management import BaseCommand
from home.models import CustomText, HomePage
def load_initial_data():
homepage_body = """
<h1 class="display-4 text-center">project-57</h1>
<p class="lead">
This is the sample application created and deployed from the crowdbotics slack a... |
0f8a104e35d68d2b4f680480724b7ad70e3879fb | 89dfb641593a95976eaab5f5f933e68ed9024fc3 | incnone/AdventOfCode | /2021/day24.py | Python | py | 3,013 | no_license | import textwrap
def get_test_input() -> str:
return textwrap.dedent("""\
""")
def read_input(day_number, test=False):
if test:
return parse_input(get_test_input())
else:
filename = 'input/day{}.txt'.format(day_number)
with open(filename, 'r') as file:
return parse... |
7441747cb09d03bf326c1296ffe82e81d1342e72 | f467df3ce0057a54020b898293bf8a910cef6d3b | dominatorX/reducer-mechanics | /d_tank.py | Python | py | 11,946 | no_license | from pyautocad import Autocad, APoint
from d_l import d_l
from d_c import d_c
from d_pointline import d_pointline
from d_bear_sup import d_bear_sup
from math import cos,sin
from d_oil_gauge import d_oil_gauge
from d_arc import d_arc
from d_spl import d_spl
import random
def d_tank_u(acad,up,down,left,right,... |
d4c7688865d7efd2b03e14efc504ce4477c797c1 | 8465f63ad77257cbced51dc21b0955bf0495b727 | Xiaoyang-Lu/sst-elements | /src/sst/elements/memHierarchy/tests/testBackendDelayBuffer.py | Python | py | 8,502 | permissive | # Automatically generated SST Python input
import sst
# Testing
# Different simpleDRAM parameters from simpleDRAM tests
# mru/lru/nmru cache replacement
# Lower latencies
# DelayBuffer backend
# Define the simulation components
comp_cpu0 = sst.Component("cpu0", "memHierarchy.trivialCPU")
iface0 = comp_cpu0.setSubCom... |
48dcfb379ee45a71eca774de00f9bce87c3fb4de | 503223e4a2ff9589b4d434b0fb1a01eb096a4d84 | NestorMonroy/Courses-coursera | /Python-for-Everybody/Python-Databases/Databases-and-SQL/Twitter/twdump.py | Python | py | 465 | no_license | import sqlite3
# conn = sqlite3.connect('spider.sqlite')
# cur = conn.cursor()
# cur.execute('SELECT * FROM Twitter')
# count = 0
# for row in cur:
# print(row)
# count = count + 1
# print(count, 'rows.')
# cur.close()
conn = sqlite3.connect('friends.sqlite')
cur = conn.cursor()
#cur.execute('SELECT * FROM P... |
47e0b7a830f917ba919c732bbbec8863ab28f74a | a01ce0a58fb93a3c2585eedd08515110055ab827 | wangbo0316/lc-system | /LcSystem/apps/users/migrations/0002_auto_20181108_0838.py | Python | py | 419 | no_license | # Generated by Django 2.1.2 on 2018-11-08 08:38
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('users', '0001_initial'),
]
operations = [
migrations.AlterField(
model_name='userprofile',
name='acces... |
2fe821784368372d6d924e79f3ce44fde648e78a | 6ecdbae98bd3cb067d84be5d36ff5999f7777101 | Pluxbox/radiomanager-python-client | /test/test_contact_results.py | Python | py | 879 | permissive | # coding: utf-8
"""
RadioManager
RadioManager # noqa: E501
OpenAPI spec version: 2.0
Contact: support@pluxbox.com
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from __future__ import absolute_import
import unittest
import radiomanager_sdk
from radiomanager_sdk.models.c... |
73bbac6204f698c64e5576487cd87b4d57253c83 | 3337b206d5198c56f0b38bdf2212fabdd0a2ad09 | lukaszlacinski/esgf-ingestion | /ingestion/models.py | Python | py | 2,903 | no_license | import datetime
from pyramid.security import (
Allow,
Everyone,
Authenticated,
)
from sqlalchemy import (
Column,
Index,
Integer,
String,
Text,
DateTime,
ForeignKey,
UniqueConstraint,
)
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.orm imp... |
dd24da14703d756608a734fd72039f20544e84c1 | 60ecbc66a545eaa3adb1b2dc460b56bacf4e0303 | GordusLab/ufmf | /motmot/ufmf/ufmf.py | Python | py | 48,596 | no_license | from __future__ import division
import sys
import struct, collections
import warnings
import os.path, hashlib
import os, stat
import numpy
import numpy as np
from numpy import nan
import time
import math
import motmot.FlyMovieFormat.FlyMovieFormat as FMF
def bchr(intval):
return bytes(bytearray((intval,)))
... |
54e63bfaec013b58bc7d2a1d20743a7fe7d13da0 | cc4c6beeeba40a4b1fcf5f9a551c2db3853f8cea | zguesmi/image2text | /app/src/app.py | Python | py | 4,710 | permissive | import os
import sys
import subprocess
import imghdr
import yaml
import yamlordereddictloader
import custom_exceptions as customExceptions
from consensus import Consensus
from ocr import OCR
class Flag:
taskStarted = '[INFO] processing file {}'
taskEnded = '[INFO] done..\n'
executionEnded = '[INFO] Tex... |
f993d0ede89cb913492c7b76763263aa0857713d | 8d87dbd9ae6a66d32c2ca197d92af14b89638370 | 1ucian0/qiskit-terra | /qiskit/algorithms/evolvers/evolution_problem.py | Python | py | 4,831 | permissive | # This code is part of Qiskit.
#
# (C) Copyright IBM 2022.
#
# This code is licensed under the Apache License, Version 2.0. You may
# obtain a copy of this license in the LICENSE.txt file in the root directory
# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0.
#
# Any modifications or derivative wo... |
10f3942ac7c700ae7585dc5cd0b37899d0bd7255 | ce504574645346cc8323e324da821932b889b9b9 | apache/ignite | /docs/_docs/code-snippets/python/auth.py | Python | py | 1,308 | 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 use ... |
323e737686f273a1bdbbde33edf4ec2738c6f0d5 | 8e2e86cce5c76012da5c1fa6a19de457cb61bc97 | kinect59/MTCNN-Tensorflow | /evaluate/RunOnFDDBLandmark.py | Python | py | 3,697 | permissive | # coding:utf-8
import sys
sys.path.append("..")
import argparse
from train_models.mtcnn_model import P_Net, R_Net, O_Net
from prepare_data.loader import TestLoader
from Detection.detector import Detector
from Detection.fcn_detector import FcnDetector
from Detection.MtcnnDetector import MtcnnDetector
import cv2
import o... |
c6f1bec685792eaea279e73c64b041acf6b53058 | c7179e0a479753498f4dd9d9d4545e9872bb4572 | rwblair/BLiMP | /sqlite/migrations/migrations/versions/d2390547d93f_.py | Python | py | 13,500 | permissive | """empty message
Revision ID: d2390547d93f
Revises:
Create Date: 2019-05-29 15:06:31.363457
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = 'd2390547d93f'
down_revision = None
branch_labels = None
depends_on = None
def upgrade():
# ### commands auto gene... |
200b2b430b5264d0bbbe51c29a6d2536a3d90f95 | 4bdcf74879adc89c27a24c3bf9e6085a3baf7592 | niharika68/Fine-grained-_emotio_-detection | /test_twitter_data.py | Python | py | 312 | no_license | #!/usr/bin/env python
import get_twitter_data
import sys
## PLACE YOUR CREDENTIALS in config.json file or run this file with appropriate arguments from command line
keyword = sys.argv[1]
time = 'today'
twitterData = get_twitter_data.TwitterData()
tweets = twitterData.getTwitterData(keyword, time)
print tweets
|
bf261f4c822e9e7f18f82b968ddb1bbdec2dcfc9 | 27592d8bce7aa0a4b48cd573923118ae38b8524b | baffolobill/scrapy-sentry | /scrapy_sentry/middlewares.py | Python | py | 1,110 | permissive | import logging
import sys
from scrapy import log
from .utils import RavenClient
class SentryMiddleware(RavenClient):
@classmethod
def from_crawler(cls, crawler):
cls.raven_client = super().from_crawler(crawler)
return cls()
def trigger(self, exception, spider=None, extra={}):
ex... |
bc60e36243abc9f01894070d96cbb67a36c23510 | 671b4d47fd055dcc297ae5d557d86ef5e48ae2d9 | head1ton/gameServer_python | /Resource.py | Python | py | 4,459 | no_license | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#玩家资源
class _Resource():
def __init__(self,acer = 0,copper = 50000,book = 0,soul = 0,forage = 60,feats = 0,medal = 0,friendpoint = 0):
#self.resource = {'acer':acer,'copper':copper,'book':book,'soul':soul,'forage':forage,'feats':feats,'medal':medal,'friendpoint... |
f5d9f7c918e3265e7550c10ee1ce7e203abcf9fb | d57a6210c8bf5d97b2c51be37d83050dd46d47a2 | qianrenjian/Adversarial-Cross-Lingual-Context-Vectors | /crosslingual_bert/tests/test_translator.py | Python | py | 872 | no_license | import torch
from model import TranslatorModel, BertConfig
import pdb
print("Starting unittests for translator model...")
vocab_size = 10000
seq_len = 4
batch_size = 5
config = BertConfig(vocab_size=vocab_size)
model = TranslatorModel(config)
print("passed initialization test")
test_encoder = torch.rand(batch_size... |
0cd8d46e6683f98d74fb70a2f106fd8835cf2d14 | e52a2da46940febb17528b638fcc0943dee5bb39 | thtran97/Semantic-Segmentation | /utils/image_processing.py | Python | py | 1,847 | no_license | import numpy as np
from skimage.transform import resize
def build_colormap2label(colordict) :
"""Build a RGB color to label mapping for segmentation"""
colormap2label = np.zeros(256**3)
for i, colormap in enumerate(colordict) :
# define the index of this color in map
index = colormap[0]... |
4390491c395623439d4b45fe07a33d48270e34ef | 567d826e94ed2b9287277b4be648f509ff8cb89c | nh2liu/num-opt | /num_opt/tests/autograd.py | Python | py | 3,092 | no_license | import unittest
from .util import check_float, parabola, multivar, const_ret
from ..autograd.dualnumber import DualNumber
from ..autograd.forward import grad as fgrad
from ..autograd.reverse import grad as rgrad
DUAL_1 = DualNumber(1.0, 2.0)
DUAL_2 = DualNumber(-3.1, 4.0)
DUAL_3 = DualNumber(2., 6.)
class... |
62af78a778184ab5a6681bb17af77c70feee7632 | 3bcbb2907160463a1ffa824997b1f4526702c3ce | wahello/themarket | /themarket/orders/migrations/0001_initial.py | Python | py | 1,713 | no_license | # Generated by Django 2.0.6 on 2018-08-02 11:57
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
('billing', '0001_initial'),
('carts', '0001_initial'),
('addresses', '0001_initial'),
... |
5bee250015400e27d6218fa71814eaaeab722d79 | c96e3a5e92638c56ed1dcbcbd453da2e3866d795 | oriys/oreo | /859.buddy-strings.py | Python | py | 509 | no_license | #
# @lc app=leetcode id=859 lang=python3
#
# [859] Buddy Strings
#
class Solution:
def buddyStrings(self, A: str, B: str) -> bool:
d = {}
if len(A) != len(B):
return False
for i in range(len(A)):
if A[i] != B[i]:
d[i] = [A[i], B[i]]
if len(d)... |
1b13d9bea98be17cb6d991401b8755471df9740b | 14beebc11b22903843e75d5b4f7e2a243d094b34 | gerac83/ug_bluerobot | /clopema_testbed/clopema_robot/scripts/test_planning_and_execution.py | Python | py | 1,242 | no_license | #!/usr/bin/env python
# Copyright (c) CloPeMa, EU-FP7 - All Rights Reserved
#
# Author: Libor Wagner <wagnelib@cmp.felk.cvut.cz>
# Institute: Czech Technical University in Prague
# Created on: Oct 21, 2014
# ---- Imports --------------------------------------------------------------- #
import rospy
import n... |
2f03adc287bfea0501919b9af0e36aa749b25d5c | 2fe38557f66b95e7624b412e660e8529630a8feb | Eric54920/spider | /scrapy/wangyixinwen/wangyixinwen/spiders/xinwen.py | Python | py | 1,573 | no_license | # -*- coding: utf-8 -*-
import scrapy
from selenium import webdriver
from wangyixinwen.items import WangyixinwenItem
class XinwenSpider(scrapy.Spider):
name = 'xinwen'
# allowed_domains = ['www']
start_urls = ['https://news.163.com']
models_urls = []
def __init__(self):
self.bro = webdrive... |
e0ba1ded340eb8c13ce947eb6d921694ed53bab1 | 8aa8250e94ec9f51b2a9f571c3489e0dae512d06 | jacobverdesi/strava-tools | /stravatools/cli/shell.py | Python | py | 1,109 | permissive |
import click, os
from stravatools import __version__
from stravatools.client import Client
from stravatools.cli import commands
# If Pull Request accepted: from click_shell import shell
from stravatools.cli.click_shell_plus import shell
from stravatools.cli.commands import *
histfile = os.path.join(os.path.expanduser... |
d80977984e4e5f362ee8a8eae1e3a468dab7bce9 | e1840cf539990153de4e0634b81944979e6f7a19 | kmaaallen/unicorn-attractor-milestone | /tickets/migrations/0002_ticket_created_on.py | Python | py | 551 | no_license | # -*- coding: utf-8 -*-
# Generated by Django 1.11.24 on 2020-03-07 17:16
from __future__ import unicode_literals
from django.db import migrations, models
import django.utils.timezone
class Migration(migrations.Migration):
dependencies = [
('tickets', '0001_initial'),
]
operations = [
m... |
7927205e64ba9f5c13d09bd5ae07705bdca7020b | a47b84c3baca0c47af90983173179b6a9ceb7285 | jorgermurillo/s3filter | /scripts/plot_topk.py | Python | py | 11,672 | no_license | import os
import matplotlib.pyplot as plt
import csv
import re
plt.style.use('classic')
plt.rcParams.update({'font.size': 16, 'font.family' : 'serif'})
colors = ['#00cccc', '#f08080', '#d7b8ff', '#fff68f', '#00e595']
def parse(fname):
total_time = 0
total_bytes_returned = 0
total_bytes_scanned = 0
pha... |
f13564ff953c3d389f47eaf80d8bc501718db106 | 0ce6c7e4ab2db72372dba0fb2a4402cf6065ee38 | jwang-a/CTF | /Practice/Pwnable.tw/breakout/exp.py | Python | py | 2,524 | no_license | ###realloc not clearing data + IO_list_all hijack
from pwn import *
from IO_FILE import *
###Utils
def List():
r.sendlineafter('>','list')
ret = []
for i in range(10):
ret.append(r.recvuntil('\n\n'))
return ret[::-1]
def Note(idx,size,data):
r.sendlineafter('>','note')
r.sendlineafter... |
2ece27d1f8948617630e60611fe205bdf2b7b56d | fea0e8907fa9f1be072844f821d8e41814b8a742 | Liarra/DeedADay | /wsgi/openshift/deedaday/urls.py | Python | py | 344 | no_license | from django.conf.urls import patterns, url
from deedaday import views
urlpatterns = patterns('',
url(r'^$', views.index, name='index'),
url(r'^deeds/(?P<deed_id>\d+)/$', views.deed, name='Deed detail'),
url(r'^user/$', views.userpage, name='User page'),
url(r'^send/$', views.sendADeed, name='S... |
5a56a334a73499eb9f490061cd1c4925bd678cb1 | 7b6906a45529b8d4a21f9def293d17524b5e7a96 | coyote259/hello-world | /multiplication.py | Python | py | 689 | no_license | # -*- coding: utf-8 -*-
def product(*args):
if len(args):
y = 1
for x in args:
y = y * x
return y
else:
raise TypeError
# 测试
print('product(5) =', product(5))
print('product(5, 6) =', product(5, 6))
print('product(5, 6, 7) =', product(5, 6, 7))
print('product(5, 6, ... |
3d5635635bc4d370f483debb9b58dadd4a3c7aa9 | b86e34bfb7711f2a6d5ca74efd1aca4d3f750606 | cbrom/NN-with-Amaharic-Char-recognition | /data_collection/challenge/app/feature_extraction.py | Python | py | 2,837 | no_license | import numpy as np
import math
SEQUENCE_SIZE = 10 # Sequence of points needed to extract features
def reduce_points(points):
assert SEQUENCE_SIZE < points.shape[0]
reduced_points = []
division = points.shape[0] / SEQUENCE_SIZE
return np.array([ points[x * division] for x in range(SEQUENCE_SIZE)])... |
250751c244e5981a7cc51cb66d6f7e5ef89c8df8 | 32a9f43689d7fc4581e92a1feed59ef9ea5ad33e | lukehuang/django-automation-system | /KUDZU/views.py | Python | py | 17,370 | no_license | #from django.shortcuts import render
from django.shortcuts import get_object_or_404, render
from django.template.loader import render_to_string
from django.http import HttpResponseRedirect, HttpResponse
from django.core.urlresolvers import reverse
from KUDZU.downloadscripts import runner ,add_to_history
from django.tem... |
4ae06a67978101e6fa27d51baa8285f5fae2bb4f | b50419cbaa8ad25a01e4f546fd03dd7ef17596ae | test123test111/reflected_xss_scanner | /reflected_xss_scanner/spiders/crawler.py | Python | py | 18,734 | no_license | import urllib
import scrapy
import re
from scrapy.linkextractors import LinkExtractor
from scrapy.spiders import Rule
from scrapy.http import FormRequest, Request
from reflected_xss_scanner.spiders.crawlerrule import CrawlerRule
from urlparse import urlparse, urlsplit,parse_qs,urljoin
from os.path import splitext
from... |
bd998ff84cb8f1b097a23bc15b6c5657b9705137 | e768508ceda8e2fb4d0ca6ef142a22d279701be9 | demisto/content | /Packs/ExpanseV2/Integrations/ExpanseV2/ExpanseV2_test.py | Python | py | 84,092 | permissive | """Expanse V2 Integration for Cortex XSOAR - Unit Tests file
"""
import json
import io
import copy
import demistomock as demisto
import pytest
from ExpanseV2 import DEPRECATED_COMMANDS, DeprecatedCommandException
INTEGRATION_NAME = 'ExpanseV2'
@pytest.fixture(autouse=True)
def handle_calling_context(mocker):
m... |
66cf4c6e6881be2a8cc03e331442f76e446dfc30 | 8f7a4705e97aec7d4fc5a64fdd9215b7785d8794 | nischalstha9/bs4djcarousel | /carousel/views.py | Python | py | 432 | no_license | from django.shortcuts import render, get_object_or_404, redirect
from django.views.generic import DetailView
from .models import Carousel, Photo
# Create your views here.
class CarouselView(DetailView):
model = Carousel
template_name = 'carousel.html'
# def CarouselView(request, carousel_id):
# carousel = ... |
137c31a86db6e5b0d3a459e06f265bd574122861 | a4c30836aa65ac5b90602776bfd673a4394b42a3 | sbitz/pyprimes | /src/primes/heaps.py | Python | py | 3,940 | no_license | from .cursors import PrimeCursor
class FibNode(object):
def __init__(self, k, v):
self.key = k
self.container = [v]
self.children = []
self.marked = False
self.degree = 0
def __len__(self):
_len = len(self.container)
for x in self.children:
... |
f4be206631f191dac3cc4b8cc933b0c46e67ef35 | 98d49b324d884c3287d5866b973e0acc36f0ce76 | isingh/exPresso-backup | /settings.py | Python | py | 4,958 | no_license | # Django settings for exPresso project.
DEBUG = True
TEMPLATE_DEBUG = DEBUG
ADMINS = (
# ('Your Name', 'your_email@example.com'),
)
MANAGERS = ADMINS
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3', # Add 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'.
... |
d79d35fcdcfcb27134cd9aa4aa85f6a9b9d8048b | 52464ddb3ce2dad40e655336d114128099c89d5c | kdheepak/psst | /psst/scenarios/reduction.py | Python | py | 13,587 | permissive | r"""
Scenario module
This module contains functions for operating on scenarios.
simulatenous_backward_reduction and fast_forward_selection can reduce a :math:`N` scenarios to
:math:`N_{red}`.
Algorithm based on
* http://www.mathematik.hu-berlin.de/~heitsch/ieee03ghr.pdf
* https://www.gams.com/presentations/present_... |
bb7f3319c1f82c3b26dd089fc74bf968fcec1ed4 | 7a0eab70c09b8d5f3a71443a63550021f17cfe59 | h4ck3rm1k3/scratch | /scratch/KRAMS/src/apps/scratch/jakub/adaptive/2d_adaptive_bc.py | Python | py | 4,037 | no_license | '''
Created on Mar 22, 2011
@author: jakub
'''
from ibvpy.core.astrategy import AStrategyBase
from ibvpy.api import BCDof, BCDofGroup, FEGrid, BCSlice
from ibvpy.mats.mats2D.mats2D_elastic.mats2D_elastic import MATS2DElastic
from ibvpy.fets.fets2D.fets2D4q import FETS2D4Q
from ibvpy.fets.fets2D.fets2D4q8u import FETS... |
29293fff63e2ba30103fccda53a03417c0664b18 | f29f01867b67263f17cfe810954b5f81c5ddfd46 | VineethBS/DTN_Simulations | /Feedback/Feedback-Random-RD/SprayWait.py | Python | py | 11,634 | no_license | #!/usr/bin/python3
# CHANGE: 12-07-2019 - enforce FIFO order of service at the source instead of the arbitrary order of service
# CHANGE: 09-07-2019 - self-monitoring of the source queue - if the average source queue length is large then we can exit early
# CHANGE: 26-06-2019 - inclusion of instantaneous packet feedbac... |
8392028c07e159cbbe9783ad9013108e17763a8e | 3756fa51641d07a44b9c6f33f6e81b5466e107b1 | dr-dos-ok/Code_Jam_Webscraper | /solutions_python/Problem_156/640.py | Python | py | 370 | no_license | import sys
t = int(input())
for tc in range(1,t+1):
n = input()
b = [int(x) for x in input().split()]
ans = 0
best = max(b)
b.sort(reverse=True)
for i in range(1, max(b)):
ok = True
specials = 0
for x in b:
specials += (x-1)//i
best = min(best, i + spe... |
aec21488fb8b89368e00193a07fa79d3f9e3ea10 | bfe9592e5d0c6f9bbb6d519528475b0ac3327de2 | sociomantic-tsunami/mxnet | /tests/python/unittest/test_gluon_rnn.py | Python | py | 26,799 | 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 u... |
687b57a39b7bf930dbf61443275fd35a11f60317 | 96ea88dcb2839a7ca0274d431891190035791250 | zbxzc35/hierarchical_classification | /Flat_Classification/Flat_Class_CV.py | Python | py | 3,036 | no_license | import pandas as pd
import sklearn
import sklearn.preprocessing
import sklearn.datasets
import sklearn.linear_model
import sklearn.utils
import copy
import sklearn.cross_validation
import Flat_Classification.constants as ct
import Flat_Classification.checking as ck
N_FOLDS = 3
C_LIST = [1e-4, 1e-3, 1e-2, 1e-1, 1, 10, ... |
b1a18f5be0d0fe56e9f0b68b763cc0ff257b70fa | 86b3ed84e35c225897c0993ecb453c2c9468ed1f | aiogram/aiogram | /aiogram/utils/mixins.py | Python | py | 2,923 | permissive | from __future__ import annotations
import contextvars
from typing import TYPE_CHECKING, Any, Dict, Generic, Optional, TypeVar, cast, overload
if TYPE_CHECKING:
from typing_extensions import Literal
__all__ = ("ContextInstanceMixin", "DataMixin")
class DataMixin:
@property
def data(self) -> Dict[str, An... |
a9321f27754e57c66b3b4bad67c44c1816186230 | 5e54d6267af17616657ef91f9325c52b65bfd8bf | dracoeau/projet_python_ppgdalia | /Django API/ppgdalia/prediction/views.py | Python | py | 2,575 | no_license | from django.shortcuts import render
# Create your views here.
from rest_framework import viewsets
from rest_framework import mixins
from prediction.models import Endpoint
from prediction.serializers import EndpointSerializer
from prediction.models import MLAlgorithm
from prediction.serializers import MLAlgorithmSer... |
b89e0895de356a849911a2bd7604cfba0bf38a2c | 7fc546c6a3db67941e7406ac48f4d6d634250339 | esalesky/NMTGMinor | /autoencoder.py | Python | py | 5,519 | permissive | from __future__ import division
import onmt
import onmt.Markdown
import onmt.modules
import argparse
import torch
import torch.nn as nn
from torch import cuda
from torch.autograd import Variable
import math
import time, datetime
from onmt.modules.Loss import NMTLossFunc
from onmt.ModelConstructor import build_model, i... |
9b88f77c413df3a126cb71ccdd9311067cc0ffb8 | 77a3e34a691393dafa4fbb70623e56fcb47d852c | kernel72/game-of-words | /backend/src/tools/indexDictonary.py | Python | py | 3,234 | permissive | # python 3.9 required
import sys
import json
from dataclasses import dataclass, asdict
DICTIONARY_PATH = "../../dicts/hagen-morf.txt"
@dataclass
class MainWord:
word: str
included_words: list[str]
def load_and_filter_words_from_dictionary(dictionary_path: str) -> set[str]:
filtered_words: set[str] = se... |
25ed9729c046df864c195a84b8b909feb4cd9dcc | ccd1f4d4f391adf387aa0dfd4f5fbc9981020880 | sabiqxs/PythonLearn | /OOPLearning/Automateparsing File.py | Python | py | 491 | no_license | import os
os.chdir('/Python Projects/CobaSaja/Rename/')
print(os.getcwd())
for n in os.listdir():
f_name, f_ext = os.path.splitext(n)
p_month, p_day, p_num = f_name.split('-')
# menghilangkan Spasi saat parsing, zfill menambahkan 0 di penomoran
p_month = p_month.strip()
p_day = p_day.strip()
p... |
b61194df94aa50c074a044aa9d275724ef1f4825 | 8efcbf017ea4a8ab64a7962ff7daff7af11cad1a | pombredanne/dezede | /libretto/models/evenement.py | Python | py | 16,099 | permissive | # coding: utf-8
from __future__ import unicode_literals
import warnings
from django.contrib.contenttypes.models import ContentType
from django.contrib.contenttypes.generic import GenericForeignKey, \
GenericRelation
from django.core.exceptions import ValidationError
from... |
3c2eab36ea305aa681da38ed9c4c6f4e35ddf51e | 79b715dd25eed3f064e5dd74810fdad290efbcf6 | rcadia/gcwebapp | /tests/createWorkout_Test.py | Python | py | 1,259 | no_license | from gcwebapp.Constants import TT_Constants
from gcwebapp.BaseTestCase import BaseTestCase
from random import randint
import unittest
import time
import nose
from gcwebapp.pages.LandingPage import LandingPage
from gcwebapp.pages.ProHomePage import Pr... |
45d989b2a17aab9e46e5f9831cd0c599e486f766 | 5ce680b9f1d76a569a2bca53dd50423a07e7fbfa | qt37424/AI_book | /gui_quang.py | Python | py | 1,690 | no_license | import tensorflow.keras
# from PIL import Image, ImageOps
import cv2
import numpy as np
# Disable scientific notation for clarity
# np.set_printoptions(suppress=True)
# Load the model
model = tensorflow.keras.models.load_model('model/model.h5')
# # Create the array of the right shape to feed into the keras model
# #... |
6b33102aba5ddfaa9bd46b5250304395539e8c51 | ff36ae89a36f40400eb25f30a8bbe82211cc8a46 | josesandino/JKSA | /carritos/migrations/0004_rename_user_carrito_usuario.py | Python | py | 373 | no_license | # Generated by Django 3.2.4 on 2021-07-06 04:53
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('carritos', '0003_rename_usuario_carrito_user'),
]
operations = [
migrations.RenameField(
model_name='carrito',
old_name='use... |
49e32d7b840bd0ce5f9c1e17d1720a61484114b3 | 64cab3a827e661a71c54024611af815de6c1d8c8 | RORO11/TalkNet_ASD | /model/talkNetModel.py | Python | py | 2,349 | no_license | import torch
import torch.nn as nn
from model.audioEncoder import audioEncoder
from model.visualEncoder import visualFrontend, visualTCN, visualConv1D
from model.attentionLayer import attentionLayer
class talkNetModel(nn.Module):
def __init__(self):
super(talkNetModel, self).__init__(... |
87aa85ed8653df0e837d02675d09330d6e8336ad | 7040839e25abd5e1f25379bc4bbcde1f09c272cf | CNR-ITTIG/plasodfaxp | /plaso/parsers/esedb_plugins/msie_webcache.py | Python | py | 11,561 | permissive | # -*- coding: utf-8 -*-
"""Parser for the Microsoft Internet Explorer WebCache ESE database.
The WebCache database (WebCacheV01.dat or WebCacheV24.dat) are used by MSIE
as of version 10.
"""
import logging
from plaso.events import time_events
from plaso.lib import eventdata
from plaso.parsers import esedb
from plaso... |
12d87f53c82dd365670421fa34945db624155154 | f7e79366c7bcb3f737a3d7fadbde2bc6755c248f | tpopordanoska/confidence-intervals | /cieg/experiments/methods/pmatrix.py | Python | py | 9,357 | permissive | import os
import numpy as np
import torch
def pmatrix_bounds(eigvals_lower, eigvals_upper, eigvects_lower, eigvects_upper, sigma, eig):
inv_eigvals_lower, inv_eigvals_upper = get_inverse_eigenvalue_bounds(eigvals_lower, eigvals_upper)
p = eig.eigenvalues.size()[0]
lower_bound, upper_bound = get_pmatrix_b... |
c82133e4ead5909ea93938ce1d55e03f940f5b89 | 5b58fd3092b023458999d2b2ced1a06549c04bc9 | ammuv/Projects | /Simple Distributed Blockchain/src/time_server.py | Python | py | 1,607 | no_license | # this will be a server
# It will receive requests from clients for current time and will return the time
import time
import random
# import socket programming library
import socket
# import thread module
from _thread import *
import threading
tau = 5 #for simulating delay
# thread function
def ... |
e07ac7efbeb6b8bf462f3c4250c6b9a90127f15f | 0154430cd812860836dfc0c094afce6830f47e2d | ljmerza/devCenter | /devcenter/codecloud/codecloud.py | Python | py | 323 | no_license | """Wrapper for the code cloud API."""
from .api import CodeCloudApi
from .git import Git
from .reviewers import Reviewers
from .pull_requests import PullRequests
from .comments import Comments
class CodeCloud(Git, Reviewers, PullRequests, Comments):
"""Wrapper for the code cloud API."""
code_cloud_api = CodeCloudAp... |
0d5cd1da0607c64edfa473e2469bced0b61c2f6b | b4554ae9e59af40ad5a2f5ea6ec0f2343cc79f90 | HelenMel/WebsiteStatusesAggregators | /consumer/setup.py | Python | py | 1,102 | permissive | import os
from setuptools import setup, find_packages
def read(fname):
return open(os.path.join(os.path.dirname(__file__), fname)).read()
def get_requirements(req_file):
"""Read requirements file and return packages and git repos separately"""
requirements = []
lines = read(req_file).split("\n")
f... |
c16721b69b714f3183ffd6489cafa646401f39e9 | efc71ace2202d3693773450367b39aaf2603a302 | siddha149/django-wholesale-fileupload-pagination | /wholesale/urls.py | Python | py | 1,081 | no_license | from django.conf.urls import url
from . import views
urlpatterns = [
url(r'^$', views.loginpage, name='loginpage'),
url(r'^invalidlogin/$', views.invalidlogin, name='invalidlogin'),
url(r'^loginauth/$', views.loginauth, name='loginauth'),
url(r'^logoutpage/$', views.logoutpage, name='logoutpag... |
e1cec35a3b5c3dc51eb426434ef45f9364d7a30d | 159eeb02e4943a72bfc3cf973169e5a38dd8fd0f | fishleongxhh/LeetCode | /String/557_ReverseWordsInAString2.py | Python | py | 309 | no_license | # -*- coding: utf-8 -*-
# Author: Xu Hanhui
# 此程序用来求解LeetCode557: Reverse Words in a String2问题
def reverseWords(s):
res = map(lambda x:x[::-1], s.split())
return ' '.join(res)
if __name__ == "__main__":
s = "Let's take LeetCode contest"
print(s)
print(reverseWords(s))
|
df4b6aedd14c7cc924c6680de0e3341360899e5f | 3e116de852c94279cf51bc49a3101d2a839b4e5d | dmis-lab/GeNER | /densephrases/model.py | Python | py | 4,735 | permissive | import copy
import logging
import numpy as np
import os
from densephrases import Options
from densephrases.utils.single_utils import load_encoder
from densephrases.utils.open_utils import load_phrase_index, get_query2vec, load_qa_pairs
from densephrases.utils.squad_utils import TrueCaser
logger = logging.getLogger(__... |
fbc5e7ef94df13782fbceeaff6972ca14a530526 | fb434c019cdfd7742c42e627e14cefe78c2742b6 | ShenJianPing0307/fastapi-series | /fastapi-base/sql-example/sql_app_complex/crud.py | Python | py | 930 | no_license | from sqlalchemy.orm import Session
import models, schemas
# 通过id查询用户
def get_user(db: Session, user_id: int):
return db.query(models.User).filter(models.User.id == user_id).first()
# 新建用户
def db_create_user(db: Session, user: schemas.UserCreate):
fake_hashed_password = user.password + "notreallyhashed"
... |
7926ef8ea02b906d32d5cd68dd3bbee8828cfcb6 | ffa9571483d853a2da41979e65eeb04f5a009cf1 | Aradhana2402/Alien_invasion | /alien_invasion.py | Python | py | 1,371 | no_license | import pygame
import sys
from settings import Settings
from ship import Ship
import game_functions as gf
from pygame.sprite import Group
from alien import Alien
from game_stats import GameStats
from button import Button
def run_game():
# Initialize game and create a screen object
pygame.init()
ai_setti... |
27dfbc9a14ced18c6cb57a9744486417b6bb9483 | 63404e8c4d5364615814ad6fafff3f37b1dab5e0 | FlyingMedusa/PythonELTIT | /Python from scratch/018mean_duration_extended.py | Python | py | 790 | no_license | import openpyxl
wb = openpyxl.load_workbook('sample.xlsx', read_only = True)
sheet = wb['Sheet1']
user = input("Please give me indexes - from and to [separated by spaces]\n"
"Remember to select ONE column (e.g. B2 and B5 - not B2 and D4)\n\t")
list_indexes = user.split(" ")
start_name = list_indexes[0]... |
3fc229b9609957548d9c3743fdc1e6783da59c7b | ca0f9c0d0fbe73f76b37b52dbee57c30fd6a7055 | WeiS49/leetcode | /Solution/哈希表 双指针/滑动窗口/643.子数组最大平均数-i.py | Python | py | 816 | no_license | #
# @lc app=leetcode.cn id=643 lang=python3
#
# [643] 子数组最大平均数 I
# 1. 创建初始值: 最大总和sum_, 最大平均数(返回值)ans
# 2. 定义左边界start=0, 右边界从0开始循环递增
# 3. 滑动窗口长度 == 最大长度k: 执行比较赋值操作
# 4. 若窗口达到上限, 左边界移动
# 5. 返回ans
# Time: O(n)
# Space: O(1)
# @lc code=start
class Solution:
def findMaxAverage(self, nums: List[int], k: int) -> float:... |
bf61b3e1582384ea58c109074e8c1d2867340556 | cdd18d27f89c1db73514d8579243db8198de7b95 | vincijy/ethereum2-etl | /ethereum2etl/service/ethereum2_service.py | Python | py | 3,773 | permissive | # MIT License
#
# Copyright (c) 2020 Evgeny Medvedev, evge.medvedev@gmail.com
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# ... |
4893de3daae581792da8b0e9e82aee92a14806e1 | 36536fb9323f82e0c93f8305e228ac4dd2566d24 | barrygg/Study | /Practice/Password Hacker/task/hacking/hack.py | Python | py | 233 | no_license | # write your code here
import socket
import sys
s = sys.argv
address = (s[1], int(s[2]))
data = s[3]
hacker = socket.socket()
hacker.connect(address)
hacker.send(data.encode())
response = hacker.recv(1024)
print(response.decode())
|
561b62f8d07afb74b1c2f64e55db3870a9529529 | 12639aeb8a7704f7f347329757d3ff1a1032359d | sumitsharnov/AddDeleteUpdateDjangoForms | /sumittry/asgi.py | Python | py | 393 | no_license | """
ASGI config for sumittry project.
It exposes the ASGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/3.0/howto/deployment/asgi/
"""
import os
from django.core.asgi import get_asgi_application
os.environ.setdefault('DJANGO_SETT... |
b7031edb4547b705834d31d72cfbe6ff813706c9 | 89f5b782a0b2e2187d97790709d0666fe72696b9 | edelperi/imfractal | /tests/test_MFS.py | Python | py | 2,354 | permissive | """
Copyright (c) 2013 Rodrigo Baravalle
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following... |
051a4109ebf90e1dca2d131ccfcb4b594a8bbba9 | 2aa7f938d16141f3d675992003126760ab260f52 | pipul/cinder | /cinder/volume/drivers/nexenta/nfs.py | Python | py | 14,857 | permissive | # vim: tabstop=4 shiftwidth=4 softtabstop=4
#
# Copyright 2013 Nexenta Systems, Inc.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apa... |
4aca3e5775272b0bbd5808f1cbae5f18702f2636 | 7317d519b4802d09bb7420ae40192e7a34eec5e7 | sheraha/todoproject_2 | /todoapp/views.py | Python | py | 875 | no_license | from django.shortcuts import render
from django.views.generic import ListView, DetailView, CreateView, DeleteView, UpdateView
from .models import TodoModel
from django.urls import reverse_lazy
# Create your views here.
class TodoList(ListView):
template_name = 'list.html'
model = TodoModel
class TodoDetail(De... |
065e6ef9d902452290e990b37ec46e252e232542 | 3c19a49edeadd08c322d453f2ee3e0c3375b417f | khaldounZaki/rental | /models/rental_process.py | Python | py | 2,484 | no_license | from odoo import fields, models , api, _
from odoo.exceptions import ValidationError
import logging
log = logging.getLogger(__name__)
log.info(log)
class rentalProcess(models.Model):
_name="rental_process"
_description = "basic information of rental process"
_rec_name = "process_number"
... |
38e815197c1559e5cf2de9e8e027e208571e2e6f | 9221ded83a0e9d82e15cbb25bc304a541cc2f6ef | CodeHemP/CAREER-TRACK-Data-Scientist-with-Python | /16_Cleaning Data in Python [Part - 1]/02_Text and categorical data problems/04_Inconsistent categories.py | Python | py | 4,231 | permissive | '''
4 - Inconsistent categories:
In this exercise, you'll be revisiting the airlines DataFrame from the
previous lesson.
As a reminder, the DataFrame contains flight metadata such as the airline,
the destination, waiting times as well as answers to key questions regarding
cleanliness, safety, and satisfaction on... |
2d6dac4e3f24f2ae999cb8eee13e99633525a84c | 08127822e1c82f8572fc5038b928efa099ef3815 | yuan776/zr-obp | /tests/ope/test_meta.py | Python | py | 29,605 | permissive | from typing import Dict, Optional, Union
from dataclasses import dataclass
import itertools
from copy import deepcopy
import pytest
import numpy as np
import pandas as pd
from pandas.testing import assert_frame_equal
import torch
from obp.types import BanditFeedback
from obp.ope import OffPolicyEvaluation, BaseOffPol... |
fa3895a66a70e046cef398dda5fe5211ead3a18b | 20677eb9b2f34403247cc412c8c37470ab3a29e2 | hamin7/ITE3035_Python | /Data_Science/Volume/Upbit-2018-BTC-ExchanTrans-AccTrans.py | Python | py | 1,395 | no_license | # Upbit 2018 BTC 교수님 거래량 - 교수님거래량/거래소 거래량
import numpy as np
import matplotlib.pyplot as plt
x = ['Jul','Aug','Sep','Oct','Nov','Dec']
y1 = [2069650043279,1149059584200,740095260000,528729908927,1247680784000,1062559403080]
y2 = [1.280066866,1.860222927,1.781144581,1.124880324,0.400038761,0.348157678]
# y3 = data_set[... |
74442e3bd63a278abebb32b858d175c55ff3ef75 | 2c15827f93f7a5de671fd926b7d6e48b3d1fcbe9 | bug00r/color-py | /setup.py | Python | py | 1,164 | permissive | from distutils.core import setup
from distutils.extension import Extension
from Cython.Distutils import build_ext
from Cython.Build import cythonize
"""from pathlib import Path
rootpath = Path('.')
libs = []
libs.append(rootpath / 'portal_src')
ext_modules = []
for lib in libs:
for file in lib.glob('**/*.py'):
fi... |
7529e07150dd49936dda09e60bdcaadfc346d1df | 5f3ac6235e83dfec88eb6500c916de78d788b99b | cartologic/arcgis_importer | /views.py | Python | py | 395 | no_license | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.contrib.auth.decorators import login_required
from django.shortcuts import render
from . import APP_NAME
# Create your views here.
@login_required
def index(request):
context = {"APP_NAME": APP_NAME}
return render(request, template... |
ed45da61055926a9d24cda3117ae582e2858727d | 5f386bf34e5340f44dd52ffd4c96da137416dd7e | chipbuster/p2-raytracer | /old-refs/raycheck.py | Python | py | 5,193 | no_license | #!/usr/bin/env python3
import re
import sys
import os
import shutil
import subprocess
import argparse
import colorama
from colorama import Fore, Style
from zipfile import ZipFile
import tarfile
from scipy.misc import imread
import numpy as np
import hashlib
from math import sqrt
def _msg(text, level, color):
retu... |
2beca10a26637b8053d88b78b465f4dbc5f25044 | 247b53e15be9d1d1b9c4bff2dd35408e007e368a | mnslarcher/udacity | /aind/term1/recognizer/my_model_selectors.py | Python | py | 6,937 | permissive | import math
import statistics
import warnings
import numpy as np
from hmmlearn.hmm import GaussianHMM
from sklearn.model_selection import KFold
from asl_utils import combine_sequences
class ModelSelector(object):
'''
base class for model selection (strategy design pattern)
'''
def __init__(self, all... |
f497dd29ac75ed6193f4ca34fcce0bd3210f27b5 | 4074bb695d18fe4801710a50c8fac6004e5b495f | epsilon-deltta/djg-api | /modules/jkpipe_3way.py | Python | py | 11,470 | no_license | #!/usr/bin/python
import sys, os, datetime, re
from glob import glob
# MISC
parseParam = lambda l: {k:v for (k,v) in l}
## SYSTEM CONFIGURATION
Z_base = '/home/jinkuk/'
#storageBase = '/dg-shared/for_jinkuk/pipeline/'
#apacheBase = '/dg-shared/for_jinkuk/pipeline/html/'
storageBase = '/dg-local/for_jinkuk/pipeli... |
eb7246af3f1dd6810c5b11b99d8f6b2efb45bde6 | 2bd1128322be7503a1bb6a79e28724c0af57833c | nayoon-kim/Algorithm | /땅따먹기.py | Python | py | 2,030 | no_license | # # -*- coding: utf-8 -*-
# # UTF-8 encoding when using korean
# import sys
# r, c, n, m = map(int, sys.stdin.readline().rstrip().split())
# m_ap = [[0] * c for _ in range(r)]
# answer = [0] * (n + 1)
# visited = [[False] * c for _ in range(r)]
# dx = [1, -1, 0, 0]
# dy = [0, 0, 1, -1]
# for _ in range(m):
# t = lis... |
7d9c8a5d39011e95d8f1078e223d3e0720c8ab89 | ccf3a0a1e6bd8fc2040840c3f4fd482266c74870 | jailukanna/100daysofcodechallenge | /simpledb.py | Python | py | 427 | no_license | import sqlite3
# connecting to the database addressbook if exists. If not, it will create dteh db automatically
connection = sqlite3.connect('addressbook.db')
# creating a cursor object to parse the database. Using this cursor, we can execute all the sql commands
c = connection.cursor()
# here we execute all sql com... |
eda4866c75cdbbd4bc71f3e9cdb6230532522013 | 70b576eafa97e7bc4eab56376be62c9965301fe8 | lijingxi96/baselines | /baselines/common/sacred_utils.py | Python | py | 2,563 | permissive | """
This files contains a set of utilities helpful when using sacred.
TODO: documentation
"""
import glob, sys, json, re
'''
This function loads all the available runs inside the specified directory.
'''
def load_runs(base_directory):
if base_directory[-1] != '/':
base_directory += '/'
ru... |
46499b0d0e2bce59ffb00cb8ebbf9c0c5f5b998c | 26f22f49ee2c0c97dc63e40fd68c54efddb58193 | yakubpeerzade/repo1 | /List_Program/append_insert_extend.py | Python | py | 282 | no_license | #this program is for append insert and extend function
l=eval(input("Enter elements in the list:"))
print("Entered list:",l)
l.append(input("Enter element to append"))
print("New list:",l)
l1=eval(input("Enter New list"))
l.extend(l1)
print("After adding new list in old one:",l)
|
4d683d18007e74e5977f24282a47e7180deca914 | 1c14ee30a0a046636cc17a4aa1f84ff836012347 | bjornin/adventofcode2020 | /day11/day11.py | Python | py | 2,486 | no_license | def get_col(seat, length):
return seat % length
def get_row(seat, length):
return seat // length
def find_seat_in_direction(layout, seat, length, d, adjacent_steps):
r, c = d
row = get_row(seat, length)
col = get_col(seat, length)
max_row = len(layout)//length - 1
step = 0
while step <... |
b773a8110abfabcc6fb0101eb3b69c201e57b17f | 517461424d8e48410b561d71bb190bc3c1993ccd | GondorFu/Lintcode | /632.二叉树的最大节点/Solution.py | Python | py | 543 | no_license | class Solution:
# @param {TreeNode} root the root of binary tree
# @return {TreeNode} the max node
def maxNode(self, root):
# Write your code here
if root == None:
return root
rlt = root
rlt = self._maxNode(rlt, root)
return rlt
def _maxNode(self,... |
89f553e73309d420f27f280ca5f4b4af21845f1e | 9d2788e7a8230aa5685f6e9f3c10462777d6ae10 | BloodD/PyTopicM | /pytm.py | Python | py | 1,186 | no_license | # -*- coding: utf-8 -*-
# emacs: -*- mode: python-mode; py-indent-offset: 4; indent-tabs-mode: nil -*-
# vi: set ft=python sts=4 ts=4 sw=4 et:
### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ##
#This code is GUI tool for topic modeling and paper recommandation task.
#Author: Dang Xiaobi... |
b3d165b4bf983247e0b7630ac5cf51851d043888 | 425f8b5e18d08622f6a07a11cc6c01030553c062 | ThiHieuLUU/OCProject13_CI_CD_Pipeline | /core/urls.py | Python | py | 991 | no_license | """core 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 vi... |
9bd2f3b16ea12269bf2ceaa728662a03879364a7 | 90986f12e528a084b49dbb0bfece3313a2140183 | nickklosterman/PythonSheriffSales | /Geocoders/GeocodeRentalRegistration2014.py | Python | py | 5,116 | no_license | #!/usr/bin/python2
#this needs to be run with python2 bc the MySQLdb library isn't available in py3
#this program geocodes a database
import geocodeV2
_Table='RentalRegistrationMontgomeryCountyOhio2014'
_Outfile = 'geocode_rentalreg_failed.txt'
def getUsernamePassword(file):
import linecache
username=lineca... |
6cb0e3accf913c75aa342299a4af073da6fd54d9 | 1d73a4cae935cffe1aeb8e9af3c3bc0646353249 | Shyam-Makwana/Cool-Python-Codes | /Print Colored Text/Print_Colored_Text.py | Python | py | 370 | no_license | from colorama import init
init(autoreset=True)
from colorama import Fore, Back, Style
print(Fore.RED + '\nSome red text')
print(Back.GREEN + 'and with a green background')
print(Style.BRIGHT + 'and in Bright text\n')
print(Fore.CYAN + 'Some cyan text')
print(Back.BLUE + 'and with a blue background')
print(Style.DIM + ... |
8f47732158ff977d9815c3674471eeac6cf1a7af | 9de20fb532b20ada63a7017b02893d4a45dcdf4d | Chriscorr27/AuthWebApp | /Unicode_LP/CRUD_task/migrations/0001_initial.py | Python | py | 2,279 | no_license | # Generated by Django 3.1 on 2020-08-27 07:21
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
]
opera... |
f8f922692430e1ffa733e6a8c3da923fb02e95f5 | 1afdcdf0f3f532aa924e884e83f9b96e69f6fd8f | jilljenn/edm2016 | /rnn_prof/tests/irt/test_linear_operators.py | Python | py | 6,434 | permissive | """
Unit tests for linear operators
"""
import numpy as np
import scipy.sparse as sp
import unittest
from rnn_prof.irt import linear_operators as undertest
from rnn_prof.irt.testing_utils import finite_diff_grad
NUM_TESTS = 5
class TestLinearOperators(unittest.TestCase):
@staticmethod
def subset_test(lin_op... |
c07f1b265b96b13b837237a98c0ab446257fbdaf | 07e487e67a0ac7e144baae9b86678e61a6bdd50d | Zh0nek/web | /lab7/7/7.py | Python | py | 260 | no_license | def is_leap(year):
leap = False
if(year%4 == 0 and year%100 != 0):
leap = True
elif(year%400 == 0):
leap = True
else:
leap = False
# Write your logic here
return leap
year = int(input())
print(is_leap(year)) |
2da51c83ea221411619b53e2f5ca3c6029d51019 | a5d264e956de2138c20d577572b5e9f4b097bfc4 | vkuznet/WMCore | /src/python/WMCore/WMBS/Oracle/Workflow/GetDeletedBlocksByWorkflow.py | Python | py | 508 | permissive | #!/usr/bin/env python
"""
_GetDeletedBlocksByWorkflow_
Oracle implementation of Workflow.GetDeletedBlocksByWorkflow
NOTE: This DAO is not used in the production code but is to be used only for debugging purposes
"""
from WMCore.WMBS.MySQL.Workflow.GetDeletedBlocksByWorkflow import GetDeletedBlocksByWorkflow as MySQL... |
595999cd4d9650d42d77f519c745e8c07d961a51 | 1b7537c92af6b74d49ec3923428eee778a457aa9 | bke0002/skyscraper | /Scraper/s.py | Python | py | 3,645 | no_license | import urllib
import scraperFunctions as scraperFunks
from bs4 import BeautifulSoup
import csv
import math
import time
from datetime import datetime
ROOTURL1 = "http://homedepot.ugc.bazaarvoice.com/1999aa/"
ROOTURL2 = "/reviews.djs?&format=embeddedhtml&page="
ROOTURL3 = "&scrollToTop=true&sort=submissionTime... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.