repo_name stringclasses 400
values | branch_name stringclasses 4
values | file_content stringlengths 16 72.5k | language stringclasses 1
value | num_lines int64 1 1.66k | avg_line_length float64 6 85 | max_line_length int64 9 949 | path stringlengths 5 103 | alphanum_fraction float64 0.29 0.89 | alpha_fraction float64 0.27 0.89 |
|---|---|---|---|---|---|---|---|---|---|
sonir/vsyn_model | refs/heads/master | from sonilab import timed_interpolation
class Shape:
""" Shape Class """
def __init__(self, type, name):
"""
To instanciate, you should set two argments.
The one is type. Type means the shape type. It is also used as address for OSC Message.
The types are /circle, /triangle, /s... | Python | 108 | 38.388889 | 182 | /shape.py | 0.536928 | 0.51442 |
sonir/vsyn_model | refs/heads/master | from sonilab import event
def run(array):
for elm in array:
adr = elm[0]
params = elm[1]
event.bang("/send" , adr, params)
| Python | 7 | 20.714285 | 41 | /send_all.py | 0.548387 | 0.535484 |
sonir/vsyn_model | refs/heads/master | from sonilab import event
import send_all
def send (adr, params):
print adr , " : " ,
for elm in params :
print elm ,
print " /// "
event.add("/send" , send)
array = []
array.append( ("/test1",[1,'a']) )
array.append( ("/test2",[2,'b']) )
array.append( ("/test3",[3,'c']) )
send_all.run(array)
... | Python | 18 | 16.722221 | 34 | /ut_send_all.py | 0.54321 | 0.524691 |
sonir/vsyn_model | refs/heads/master | import shape
from sonilab import sl_metro
metro = sl_metro.Metro(1.0)
shape.Shape.__doc__
obj = shape.Shape("/circle" , "foo")
# obj.type = "SQUARE"
obj.active = True
obj.set("x1" , 0.1)
obj.set("y1" , 0.2)
obj.set("y1" , 0.2)
obj.set("x2" , 0.3)
obj.set("y2" , 4.0)
obj.set("size" , 0.131)
obj.set("height" , 0.132... | Python | 160 | 21.68125 | 105 | /ut_shape.py | 0.62965 | 0.55084 |
sonir/vsyn_model | refs/heads/master | import time
import shapes, shape
circle1 = shape.Shape("/circle" , "circle1")
rect1 = shape.Shape("/rect" , "rect1")
shapes.add(circle1.name, circle1)
shapes.add(rect1.name, rect1)
shapes.print_all()
#Check set UID
tupple_adr_and_params1 = shapes.get_primitive(circle1.name)
tupple_adr_and_params2 = shapes.get_primit... | Python | 44 | 25.34091 | 88 | /ut_shapes.py | 0.686799 | 0.63503 |
darkrsw/inference | refs/heads/master | """
A checker for mlperf inference submissions
"""
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import argparse
import collections
import json
import logging
import os
import re
import sys
import time
# pylint: disable=missing-docstring
logging.basic... | Python | 317 | 36.602524 | 125 | /v0.5/tools/submission/submission-checker.py | 0.540856 | 0.534899 |
znc-sistemas/django-bootstrap-form | refs/heads/master | import re
from math import floor
from django import forms
from django.template import Context
from django.template.loader import get_template
from django import template
from bootstrapform import config
register = template.Library()
@register.filter
def bootstrap(element):
markup_classes = {'label': '', 'value... | Python | 209 | 30.607655 | 115 | /bootstrapform/templatetags/bootstrap.py | 0.610657 | 0.60657 |
Jinho1011/Wesing | refs/heads/master | from django.urls import reverse
from django.shortcuts import render, redirect
from django.forms import modelformset_factory
from django.views.generic import *
from .models import *
class IndexView(ListView):
model = Song
template_name = 'song/song_list.html'
def get_context_data(self, **kwargs):
... | Python | 29 | 30.310345 | 68 | /song/views.py | 0.667401 | 0.667401 |
Frozen/jinja2-precompiler | refs/heads/master | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from optparse import OptionParser
import logging
import os
import re
import sys
import jinja2
def option_parse():
parser = OptionParser()
parser.add_option("-a", "--all", action="store_true", dest="all_files", help="all files")
parser.add_option("-b", "--base", des... | Python | 137 | 36.40876 | 142 | /jinja2precompiler.py | 0.630634 | 0.625561 |
Frozen/jinja2-precompiler | refs/heads/master | # -*- coding: utf-8 -*-
import jinja2
import pytest
import jinja2precompiler
def test_IndexError():
env = jinja2.Environment(loader=jinja2.FileSystemLoader(["."]))
filter_func = jinja2precompiler.make_filter_func("", env, extensions=["html"], all_files=True)
assert filter_func("test.html") == True
assert fil... | Python | 13 | 28.846153 | 96 | /tests/test_bugs.py | 0.703608 | 0.688144 |
limkokholefork/Answerable | refs/heads/main | """Spider Tool for Answerable
This file contains the functions used to wrapp requests following
respecful practices, taking into account robots.txt, conditional
gets, caching contente, etc.
"""
import json
import requests
# from random import random as rnd
from time import sleep
from datetime import timedelta as td
... | Python | 127 | 31.047245 | 85 | /tools/spider.py | 0.624079 | 0.617199 |
limkokholefork/Answerable | refs/heads/main | """Recommender Tool for Answerable
This file contains the recommendation algorithm.
"""
from bs4 import BeautifulSoup as bs
from sklearn.feature_extraction.text import TfidfVectorizer, CountVectorizer
from sklearn.metrics.pairwise import linear_kernel
def recommend(user_qa, feed):
answered = [
x[0]["ti... | Python | 74 | 37.135136 | 86 | /models/content_based_0.py | 0.663714 | 0.658753 |
limkokholefork/Answerable | refs/heads/main | """Cache Tool for Answerable
This file contains the functions to access and modify cached content.
It may be used by different modules, so each function requires a category argument
to avoid collisions.
As every function is intended to serve a secondary role in extern functions, the
logs have an extra level of indent... | Python | 85 | 29.788235 | 82 | /tools/cache.py | 0.604722 | 0.604341 |
limkokholefork/Answerable | refs/heads/main | """Fetcher Tool for Answerable
This file contains the high level functions in charge of data retrieval.
It provides a interface between the spider/crawler and another level of
cacheable information.
"""
import math
import json
from datetime import timedelta as td
from bs4 import BeautifulSoup
from tools import spid... | Python | 207 | 30.492754 | 200 | /tools/fetcher.py | 0.58644 | 0.574475 |
limkokholefork/Answerable | refs/heads/main | """Recommender Tool for Answerable
This file contains the recommendation algorithm.
"""
import tools.displayer
from bs4 import BeautifulSoup as bs
from sklearn.feature_extraction.text import TfidfVectorizer
from sklearn.metrics.pairwise import linear_kernel
import numpy as np
import re
def preprocessed_text_from_ht... | Python | 92 | 26.27174 | 83 | /models/content_based_1.py | 0.57234 | 0.567557 |
limkokholefork/Answerable | refs/heads/main | import re
import json
import argparse
import datetime
import textwrap
import importlib
from urllib.error import URLError
from tools import fetcher, displayer, log, spider
_current_version = "v1.1"
def latest_version():
try:
res = spider.get(
"https://api.github.com/repos/MiguelMJ/Answerable... | Python | 281 | 29.540926 | 147 | /answerable.py | 0.57807 | 0.574458 |
limkokholefork/Answerable | refs/heads/main | """Statistics Tool for Answerable
This file contains the functions used to analyze user answers.
"""
#
# TAG RELATED METRICS (USING QA)
#
_tags_info = None
def tags_info(qa):
"""Map each tag to its score, acceptance and count"""
global _tags_info
if _tags_info is not None:
return _tags_info
... | Python | 174 | 27.413794 | 83 | /tools/statistics.py | 0.618528 | 0.608617 |
limkokholefork/Answerable | refs/heads/main | """Displayer Tool for Answerable
This file contains the functions and variables used to present the data.
"""
import tools.statistics as st
#
# COLOR RELATED VARIABLES AND FUNCTIONS
#
red = (250, 0, 0)
green = (0, 250, 0)
blue = (0, 0, 250)
cyan = (0, 250, 250)
magenta = (250, 0, 250)
yellow = (250, 250, 0)
"""
wh... | Python | 169 | 22.508875 | 85 | /tools/displayer.py | 0.536622 | 0.491568 |
limkokholefork/Answerable | refs/heads/main | """Log Tool for Answerable
This file contains the functions used to log control data and debug messages
in a unified format.
"""
import re
import sys
import inspect
from tools.displayer import bold, red, magenta, fg
_logs = [] # list of file handlers
_ansire = re.compile("\\033\[[^m]+m") # ansi escape sequences
... | Python | 93 | 21.440861 | 76 | /tools/log.py | 0.605175 | 0.602779 |
prozoroff/files | refs/heads/master | import time
import threading
import os
import pwd
import grp
from client import Client
class BtsyncHelper:
global client
client = Client(host='127.0.0.1', port='8888', username='admin', password='******')
def get_folders(self):
return client.sync_folders
def check_folder(... | Python | 44 | 29.568182 | 104 | /btsynchelper.py | 0.552416 | 0.543494 |
CaptainCodex/relevancy-ranker | refs/heads/master | import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
from IPython.display import display
from sklearn.model_selection import train_test_split
from sklearn.linear_model import LinearRegression
from sklearn import metrics
customers = pd.read_csv('StudentsPerformance.csv')
display... | Python | 47 | 25.680851 | 90 | /RelevancyRanker.py | 0.75419 | 0.750199 |
ningzy/alex_misc | refs/heads/master | import os
from shutil import copyfile
if os.path.exists(''):
os.remove('')
copyfile('', ) | Python | 7 | 12.714286 | 27 | /filesaveas.py | 0.613861 | 0.613861 |
ningzy/alex_misc | refs/heads/master | import smtplib
import getpass
FROM = 'zning'
TO = 'airportico@gmail.com'
SUBJECT = 'test'
TEXT = 'testtttt'
message = """ from: %s\nto: %s\nsubject: %s\n\n%s""" % (FROM, ", ".join(TO), SUBJECT, TEXT)
try:
server = smtplib.SMTP('smtp.gmail.com', 587)
server.ehlo()
server.starttls()
user ... | Python | 22 | 21.5 | 91 | /sendemail.py | 0.574757 | 0.568932 |
AmosGarner/PyLife | refs/heads/master | import sys, argparse
import numpy as np
import matplotlib.pyplot as plot
import matplotlib.animation as animation
from helper import *
from displayTextSpawner import displayText
from inputValidator import validateInput
paused = True
iteration = 0
def update(frameNumber, image, grid, gridSize):
newGrid = grid.cop... | Python | 95 | 35.810528 | 131 | /pylife.py | 0.591364 | 0.576494 |
AmosGarner/PyLife | refs/heads/master | from alphaNumLib import *
alphaNumArray = alphaArray + numArray + specialArray
def validateInput(input):
if(checkInAlphaNumSpec(input)):
return True
else:
return False
def checkInAlphaNumSpec(input):
inputCharArray = list(input.lower())
for value in inputCharArray:
if value no... | Python | 16 | 22.8125 | 52 | /inputValidator.py | 0.685039 | 0.685039 |
AmosGarner/PyLife | refs/heads/master | import numpy as np
ON = 255
OFF = 0
vals = [ON, OFF]
def displayText(input, gridSize):
grid = generateBlankGroup(gridSize)
index = 1
x = gridSize / 2
for value in list(input):
print(5 * index)
print(gridSize)
if 5*index >= gridSize:
index = 1
x = gridSiz... | Python | 268 | 38.746269 | 66 | /displayTextSpawner.py | 0.287364 | 0.284829 |
AmosGarner/PyLife | refs/heads/master | import numpy as np
import matplotlib.pyplot as plot
import matplotlib.animation as animation
ON = 255
OFF = 0
vals = [ON, OFF]
def randomGrid(gridSize):
return np.random.choice(vals, gridSize*gridSize, p=[0.2, 0.8]).reshape(gridSize, gridSize)
def addGlider(row, col, grid):
glider = np.array([[OFF, OFF, ON],... | Python | 43 | 25.930233 | 94 | /helper.py | 0.514681 | 0.405872 |
AlenaPliusnina/Flask_API | refs/heads/main | import json
from datetime import datetime
from flask import request, make_response
from flask_restful import Resource, Api
from flask import g
from app import app, db
from flask_httpauth import HTTPBasicAuth
from app.models import User, Post, Comment
from app.schemes import posts_schema, post_schema, comment_schema,... | Python | 234 | 30.3547 | 109 | /app/api.py | 0.573842 | 0.561444 |
AlenaPliusnina/Flask_API | refs/heads/main | from datetime import datetime
from flask_bcrypt import generate_password_hash, check_password_hash
from app import db
class User(db.Model):
__tablename__ = 'users'
id = db.Column(db.Integer, primary_key=True, nullable=False)
username = db.Column(db.String(80), unique=True, nullable=False)
email = db.... | Python | 54 | 37.407406 | 95 | /app/models.py | 0.676315 | 0.667149 |
AlenaPliusnina/Flask_API | refs/heads/main | from config import Config
from flask import Flask
from flask_sqlalchemy import SQLAlchemy
from flask_migrate import Migrate
def create_app():
app = Flask(__name__)
app.config.from_object(Config)
app.debug = True
return app
app = create_app()
db = SQLAlchemy(app)
migrate = Migrate(app, db)
from ap... | Python | 21 | 16 | 39 | /app/__init__.py | 0.716292 | 0.716292 |
AlenaPliusnina/Flask_API | refs/heads/main | from flask_marshmallow import Marshmallow
from app import app
from app.models import User, Post, Comment
ma = Marshmallow(app)
class CommentSchema(ma.Schema):
class Meta:
fields = ("id", "post_id", "author_id", "title", "content", "publication_datetime")
model = Comment
ordered = True
... | Python | 39 | 25.23077 | 92 | /app/schemes.py | 0.661448 | 0.661448 |
doanguyen/chasquid | refs/heads/master | #!/usr/bin/env python3
#
# Simple SMTP client for testing purposes.
import argparse
import email.parser
import email.policy
import smtplib
import sys
ap = argparse.ArgumentParser()
ap.add_argument("--server", help="SMTP server to connect to")
ap.add_argument("--user", help="Username to use in SMTP AUTH")
ap.add_argum... | Python | 28 | 28.035715 | 78 | /test/util/smtpc.py | 0.747239 | 0.742331 |
doanguyen/chasquid | refs/heads/master | #!/usr/bin/env python
import difflib
import email.parser
import mailbox
import sys
f1, f2 = sys.argv[1:3]
expected = email.parser.Parser().parse(open(f1))
mbox = mailbox.mbox(f2, create=False)
msg = mbox[0]
diff = False
for h, val in expected.items():
if h not in msg:
print("Header missing: %r" % h)
diff = T... | Python | 77 | 20.805195 | 70 | /test/util/mail_diff | 0.599762 | 0.592019 |
nairita87/Ocean_dir | refs/heads/ocean_coastal | from geopy.distance import geodesic
from utils.gis import geodistkm
def test_gis():
albuquerque = [35.0844, -106.6504] #(lat,lon)
los_alamos = [35.8800, -106.3031] #(lat,lon)
result1 = geodesic(albuquerque,los_alamos).km
result2 = geodistkm(albuquerque[1],albuquerque[0],los_alamos[1],los_alamos[0])
... | Python | 11 | 30.727272 | 82 | /testing_and_setup/compass/ocean/hurricane/hurricane_wind_pressure/tests/utils/test_gis.py | 0.696275 | 0.598854 |
nairita87/Ocean_dir | refs/heads/ocean_coastal | import datetime
class Hurricane:
def __init__(self, center: tuple, extent: float, pcentral: float, deltap: float,
vmax: float, b: float, time: float, initial_datetime: datetime.datetime):
self.center = center # Position of the eye (lon,lat) in radians as tuple.
self.exte... | Python | 18 | 54.444443 | 102 | /testing_and_setup/compass/ocean/hurricane/hurricane_wind_pressure/hurricane_model/hurricane.py | 0.581162 | 0.577154 |
nairita87/Ocean_dir | refs/heads/ocean_coastal | #!/usr/bin/env python
'''
name: define_base_mesh
authors: Phillip J. Wolfram
This function specifies a high resolution patch for
Chris Jeffrey.
'''
import numpy as np
def cellWidthVsLatLon():
lat = np.arange(-90, 90.01, 1.0)
lon = np.arange(-180, 180.01, 2.0)
km = 1000.0
# in kms
baseRes = 120.... | Python | 28 | 20.964285 | 119 | /testing_and_setup/compass/ocean/global_ocean/HI120to12/build_mesh/define_base_mesh.py | 0.611382 | 0.539837 |
nairita87/Ocean_dir | refs/heads/ocean_coastal | # Author: Steven Brus
# Date: April, 2020
# Description: Plots syntetic wind/pressure timeseries on MPAS-O mesh
import netCDF4
import matplotlib.pyplot as plt
import numpy as np
import os
import cartopy
import cartopy.crs as ccrs
import cartopy.feature as cfeature
plt.switch_backend('agg')
cartopy.config['pre_existing... | Python | 64 | 34.71875 | 89 | /testing_and_setup/compass/ocean/hurricane/hurricane_wind_pressure/plot_winds_on_mpaso_mesh.py | 0.590114 | 0.566929 |
nairita87/Ocean_dir | refs/heads/ocean_coastal | #!/usr/bin/env python
"""
Tidal channel comparison betewen MPAS-O and analytical forcing result.
Phillip J. Wolfram
04/12/2019
"""
import numpy as np
import xarray as xr
import matplotlib.pyplot as plt
# render statically by default
plt.switch_backend('agg')
# analytical case
x = np.linspace(0,24,100)
y = np.sin(... | Python | 32 | 19.625 | 70 | /testing_and_setup/compass/ocean/surface_waves/analysis/comparison.py | 0.706061 | 0.678788 |
nairita87/Ocean_dir | refs/heads/ocean_coastal | import numpy as np
import jigsaw_to_MPAS.mesh_definition_tools as mdt
from jigsaw_to_MPAS.coastal_tools import signed_distance_from_geojson, \
compute_cell_width
from geometric_features import read_feature_collection
import xarray
# Uncomment to plot the cell size distribution.
# import matplotlib
# matplotlib.use... | Python | 88 | 32.590908 | 79 | /testing_and_setup/compass/ocean/global_ocean/SO60to10wISC/init/define_base_mesh.py | 0.611976 | 0.586942 |
nairita87/Ocean_dir | refs/heads/ocean_coastal | import numpy
from netCDF4 import Dataset
import matplotlib.pyplot as plt
import matplotlib
matplotlib.use('Agg')
fig = plt.gcf()
nRow = 4
nCol = 2
nu = ['0.01', '1', '15', '150']
iTime = [1, 2]
time = ['day 10', 'day 20']
fig, axs = plt.subplots(nRow, nCol, figsize=(
4.0 * nCol, 3.7 * nRow), constrained_layout=Tr... | Python | 34 | 29.529411 | 84 | /testing_and_setup/compass/ocean/internal_waves/5km/rpe_test/plot.py | 0.55684 | 0.514451 |
nairita87/Ocean_dir | refs/heads/ocean_coastal | import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
from netCDF4 import Dataset
import numpy
fig = plt.gcf()
fig.set_size_inches(8.0,10.0)
nRow=1 #6
nCol=2
nu=['0.01','0.1','1','10','100','1000']
iTime=[3,6]
time=['3 hrs','6 hrs']
for iRow in range(nRow):
ncfile = Dataset('output_'+str(iRow+1)+... | Python | 31 | 28.161291 | 81 | /testing_and_setup/compass/ocean/overflow/1km/rpe_test/plot.py | 0.590708 | 0.533186 |
nairita87/Ocean_dir | refs/heads/ocean_coastal | import pytest
from hurricane_model.hurricane import Hurricane
def test_hurricane():
center = [1.0,2.0] # Position of the eye (lon,lat) in decimal degrees.
extent = 100.0 # The maximum extent of the hurricane in kilometers.
vforward = [3.0, 4.0] # Forward velocity [ve, vn] in km/hr.
pcentral = 200.0 ... | Python | 26 | 38.192307 | 76 | /testing_and_setup/compass/ocean/hurricane/hurricane_wind_pressure/tests/hurricane/test_hurricane.py | 0.696762 | 0.667321 |
nairita87/Ocean_dir | refs/heads/ocean_coastal |
def sign(x):
if(x>=0):
return 1
else:
return -1
| Python | 5 | 13.4 | 17 | /testing_and_setup/compass/ocean/hurricane/hurricane_wind_pressure/utils/math.py | 0.405405 | 0.364865 |
nairita87/Ocean_dir | refs/heads/ocean_coastal | import numpy as np
import matplotlib.pyplot as plt
def example():
x,y = np.linspace(-1,1,2), np.linspace(-1,1,2)
A, B = np.zeros((2,2)), np.zeros((2,2))
A[0,0]=1
B[0,0]=-1
A[0,1]=1
B[0,1]=1
A[1,0]=-1
B[1,0]=-1
A[1,1]=-1
B[1,1]=1
fig = plt.figure()
ax = fig.add_subplot(1... | Python | 30 | 17.566668 | 50 | /testing_and_setup/compass/ocean/hurricane/hurricane_wind_pressure/ad_hoc/simple_vector_example.py | 0.505376 | 0.4319 |
nairita87/Ocean_dir | refs/heads/ocean_coastal | ../comparison.py | Python | 1 | 16 | 16 | /testing_and_setup/compass/ocean/drying_slope/zstar_variableCd/1km/analysis/comparison.py | 0.75 | 0.75 |
nairita87/Ocean_dir | refs/heads/ocean_coastal | import netCDF4
import numpy as np
import hurricane_model as Hurricane
import structures as Geogrid
import winds_io as WindModel
import matplotlib.pyplot as plt
import datetime
def write_netcdf(filename: str, curr_hurricane: Hurricane, grid: Geogrid, winds: WindModel):
# http://unidata.github.io/netcdf4-python/#se... | Python | 48 | 34.458332 | 92 | /testing_and_setup/compass/ocean/hurricane/hurricane_wind_pressure/winds_io/output_data.py | 0.666275 | 0.645711 |
nairita87/Ocean_dir | refs/heads/ocean_coastal | from winds_io import import_data
from winds_io import output_data
from structures import geogrid
import sys
import numpy as np
from winds import parameters
from winds import wind_model
def sim_hurricane():
# Read in the input file to check which grid we are using
print('Import user inputs')
traj_filename, ... | Python | 71 | 32.211269 | 104 | /testing_and_setup/compass/ocean/hurricane/hurricane_wind_pressure/main.py | 0.683051 | 0.679661 |
nairita87/Ocean_dir | refs/heads/ocean_coastal | #!/usr/bin/env python
"""
This script performs the first step of initializing the global ocean. This
includes:
Step 1. Build cellWidth array as function of latitude and longitude
Step 2. Build mesh using JIGSAW
Step 3. Convert triangles from jigsaw format to netcdf
Step 4. Convert from triangles to MPAS mesh
Step 5. C... | Python | 151 | 35.278145 | 83 | /testing_and_setup/compass/ocean/jigsaw_to_MPAS/build_mesh.py | 0.586528 | 0.579226 |
nairita87/Ocean_dir | refs/heads/ocean_coastal | import numpy as np
class GeoGrid:
def __init__(self, lon: np.ndarray, lat: np.ndarray):
"""
Constructor.
:param lon: longitude of the grid in radians, as numpy array
:param lat: latitude of the grid in radians, as numpy array
"""
self.lon = lon
self.lat = lat... | Python | 89 | 35.213482 | 117 | /testing_and_setup/compass/ocean/hurricane/hurricane_wind_pressure/structures/geogrid.py | 0.573069 | 0.566863 |
nairita87/Ocean_dir | refs/heads/ocean_coastal | import math
class Velocities:
def __init__(self, vfe, vfn, vmax):
"""
Initialize with the forward velocity components.
:param vfe: Eastward forward velocity (x-component in the Earth frame) in km/hr.
:param vfn: Northward forward velocity component (y-component in the Earth frame)... | Python | 46 | 39.239132 | 111 | /testing_and_setup/compass/ocean/hurricane/hurricane_wind_pressure/winds/velocities.py | 0.606911 | 0.598272 |
nairita87/Ocean_dir | refs/heads/ocean_coastal | import numpy as np
import math
class RadialProfile():
def __init__(self,n,extent):
self.profile = np.zeros(n,dtype=np.float64)
self.rvals = np.zeros(n,dtype=np.float64)
self.n = n
self.extent = extent
self.dr = extent/(n-1)
for i in range(0,n):
self.rval... | Python | 73 | 31.246574 | 97 | /testing_and_setup/compass/ocean/hurricane/hurricane_wind_pressure/profile_model/radialprofiles.py | 0.528887 | 0.516143 |
nairita87/Ocean_dir | refs/heads/ocean_coastal | import json
from netCDF4 import Dataset
import numpy as np
import math
from hurricane_model import hurricane
from structures import geogrid
import datetime
def read_grid_file(grid_filename: str, grid_flag: int) -> (float, float):
if grid_flag == 1:
xll, yll, cellsize, numcells_lat, numcells_lon = read_rast... | Python | 156 | 32.570515 | 120 | /testing_and_setup/compass/ocean/hurricane/hurricane_wind_pressure/winds_io/import_data.py | 0.59958 | 0.587359 |
nairita87/Ocean_dir | refs/heads/ocean_coastal | # Author: Steven Brus
# Date: April, 2020
# Description: This function writes time-varying forcing data to an input file for the model run.
import os
import numpy as np
import netCDF4
##################################################################################################
###################################... | Python | 38 | 33.605263 | 98 | /testing_and_setup/compass/ocean/hurricane/scripts/write_forcing_file.py | 0.476046 | 0.460076 |
nairita87/Ocean_dir | refs/heads/ocean_coastal | from enum import Enum
import numpy as np
import winds.parameters as Parameters
import hurricane_model as Hurricane
import structures as Geogrid
import matplotlib.pyplot as plt
import math
class PROFILE_TYPE(Enum):
HOLLAND = 'holland'
WILLOUGHBY = 'willoughby'
class WindModel:
def __init__(self, params: P... | Python | 88 | 36.511364 | 113 | /testing_and_setup/compass/ocean/hurricane/hurricane_wind_pressure/winds/wind_model.py | 0.629697 | 0.619697 |
nairita87/Ocean_dir | refs/heads/ocean_coastal | #!/usr/bin/env python
'''
Script to map cell indices from MPASO noLI mesh to those of the wLI mesh in the runoff mapping file.
Start by building a runoff mapping file that has all the mesh description from wLI mapping file
but the actual mapping from the noLI mapping file:
ncks -x -v S,col,row /project/projectdirs/acme... | Python | 94 | 37.765957 | 130 | /testing_and_setup/compass/ocean/global_ocean/scripts/copy_cell_indices_ISC.py | 0.623765 | 0.601811 |
nairita87/Ocean_dir | refs/heads/ocean_coastal | from winds.wind_model import PROFILE_TYPE
from winds.parameters import Parameters
import math
def test_parameters():
gridsize = [10, 10]
nr = 100
wind_profile_type = PROFILE_TYPE.HOLLAND
grid_position = [-106.0,35.0]
cellsize = 2.0
siderealDay = 23.934 # A sidereal day in hrs.
omega = 2.0 ... | Python | 24 | 31.541666 | 103 | /testing_and_setup/compass/ocean/hurricane/hurricane_wind_pressure/tests/winds/test_parameters.py | 0.674776 | 0.622279 |
nairita87/Ocean_dir | refs/heads/ocean_coastal | import numpy as np
from netCDF4 import Dataset
import matplotlib.pyplot as plt
import matplotlib
matplotlib.use('Agg')
fig = plt.gcf()
nRow = 1 # 2
nCol = 5
nu = ['1', '5', '10', '100', '200']
iTime = [0]
time = ['20']
# ---nx,ny for 10 km
#nx = 16
#ny = 50
# ---nx,ny for 4 km
nx = 40
ny = 126
# ---nx,ny for 1 km
... | Python | 79 | 24.012659 | 89 | /testing_and_setup/compass/ocean/baroclinic_channel/4km/rpe_test/plot.py | 0.47419 | 0.423077 |
nairita87/Ocean_dir | refs/heads/ocean_coastal | #!/usr/bin/env python
'''
name: define_base_mesh
authors: Phillip J. Wolfram
This function specifies the resolution for a coastal refined mesh for the CA coast from SF to LA for
Chris Jeffrey and Mark Galassi.
It contains the following resolution resgions:
1) a QU 120km global background resolution
2) 3km refinem... | Python | 38 | 29.947369 | 101 | /testing_and_setup/compass/ocean/global_ocean/CA120to3/build_mesh/define_base_mesh.py | 0.636905 | 0.571429 |
nairita87/Ocean_dir | refs/heads/ocean_coastal | import math
from winds.wind_model import PROFILE_TYPE
class Parameters:
def __init__(self, mean_lat: float, wind_profile_type=PROFILE_TYPE.HOLLAND):
"""
Constructor.
:param mean_lat: mean latitude of the hurricane trajectory to compute the Coroilis factor in radians
Units are km, hr... | Python | 41 | 33.048782 | 114 | /testing_and_setup/compass/ocean/hurricane/hurricane_wind_pressure/winds/parameters.py | 0.635387 | 0.616046 |
nairita87/Ocean_dir | refs/heads/ocean_coastal | import numpy
from netCDF4 import Dataset
import matplotlib.pyplot as plt
import matplotlib
matplotlib.use('Agg')
fig = plt.gcf()
nRow = 6
nCol = 2
iTime = [8, 16]
nu = ['0.01', '0.1', '1', '10', '100', '200']
time = ['hour 8', 'hour 16']
fig, axs = plt.subplots(nRow, nCol, figsize=(
5.3 * nCol, 2.0 * nRow), const... | Python | 34 | 30.470589 | 78 | /testing_and_setup/compass/ocean/lock_exchange/0.5km/rpe_test/plot.py | 0.558878 | 0.514019 |
nairita87/Ocean_dir | refs/heads/ocean_coastal | # /usr/bin/env python
"""
% Create cell width array for this mesh on a regular latitude-longitude grid.
% Outputs:
% cellWidth - m x n array, entries are desired cell width in km
% lat - latitude, vector of length m, with entries between -90 and 90, degrees
% lon - longitude, vector of length n, with entries b... | Python | 41 | 30.634146 | 84 | /testing_and_setup/compass/ocean/global_ocean/ARM60to6/init/define_base_mesh.py | 0.680802 | 0.631457 |
nairita87/Ocean_dir | refs/heads/ocean_coastal | # Author: Steven Brus
# Date April, 2020
# Description:
# This creates a "dummy" time varying forcing file
# with zero wind zero atmospheric pressure perturbation
# for the tidal spinup run.
#
# The tidal spinup is run using this "dummy" atmospheric forcing
# because the time varying atmospheric forcing... | Python | 71 | 33.915493 | 98 | /testing_and_setup/compass/ocean/hurricane/scripts/spinup_time_varying_forcing.py | 0.663306 | 0.653226 |
nairita87/Ocean_dir | refs/heads/ocean_coastal | from winds.velocities import Velocities
import math
def test_velocities():
# Forward velocity in km/hr.
vfe = -1.0 # Eastward .
vfn = 0.0 # Northward.
vg = 1.0 # Tangential gradient wind speed in km/hr.
veloc = Velocities(vfe,vfn)
r = 1.0 # Unit circle about the origin.
np = 360
dtheta... | Python | 22 | 33.545456 | 101 | /testing_and_setup/compass/ocean/hurricane/hurricane_wind_pressure/tests/winds/test_velocities.py | 0.554533 | 0.529566 |
nairita87/Ocean_dir | refs/heads/ocean_coastal | import sys
import numpy as np
import matplotlib.pyplot as plt
#from matplotlib.patches import Circle
import math
def W(x, y):
"""Return the wind vector given a wind speed."""
r = np.sqrt(x*x+y*y)
v = V(r)
if r>0:
costheta = x/r
sintheta = y/r
return [-sintheta*v,costheta*v]
... | Python | 49 | 21.897959 | 71 | /testing_and_setup/compass/ocean/hurricane/hurricane_wind_pressure/ad_hoc/wind_vector_example.py | 0.536955 | 0.511131 |
nairita87/Ocean_dir | refs/heads/ocean_coastal | from geopy.distance import geodesic
def geodistkm(x1,y1,x2,y2):
'''
Returns the geodesic distance in km given two pairs of (lon, lat) coordinates.
Note: Because it uses geopy, the coordinate order is reversed to (lat,lon)
before calling the geopy function.
:param x1: lon of the first point.
:pa... | Python | 14 | 37.642857 | 82 | /testing_and_setup/compass/ocean/hurricane/hurricane_wind_pressure/utils/gis.py | 0.685767 | 0.663586 |
nairita87/Ocean_dir | refs/heads/ocean_coastal | # Author: Steven Brus
# Date: August, 2019
# Description: Interpolates CFSR atmospheric reanalysis data onto the MPAS-O mesh and
# creates an input file to support time varying atmospheric forcing in the model
import netCDF4
import matplotlib.pyplot as plt
import numpy as np
import glob
import pprint
imp... | Python | 165 | 36.696968 | 128 | /testing_and_setup/compass/ocean/hurricane/scripts/interpolate_time_varying_forcing.py | 0.61646 | 0.59701 |
nairita87/Ocean_dir | refs/heads/ocean_coastal | import numpy as np
from structures.geogrid import GeoGrid
from profile_model.radialprofiles import HollandWindSpeedProfile
from winds.parameters import Parameters
from winds.velocities import Velocities
import matplotlib.pyplot as plt
def test_velocity_grid():
# Grid of x, y points
n = 50
nr = 200
rmax... | Python | 69 | 27.971014 | 113 | /testing_and_setup/compass/ocean/hurricane/hurricane_wind_pressure/tests/winds/test_velocity_grid.py | 0.5945 | 0.5675 |
nairita87/Ocean_dir | refs/heads/ocean_coastal | from structures.geogrid import GeoGrid
def test_geogrid():
lon = -106.0
lat = 35
nlon = 8
nlat = 4
cellsize = 1.0
defaultValue = -1.0
grid = GeoGrid(lon,lat,nlon,nlat,cellsize,defaultValue = defaultValue)
assert grid.lon == lon
assert grid.lat == lat
assert grid.nlon == nlon
... | Python | 94 | 33.936169 | 80 | /testing_and_setup/compass/ocean/hurricane/hurricane_wind_pressure/tests/structures/test_geogrid.py | 0.635312 | 0.606697 |
tamuell/my-first-blog | refs/heads/master | name = "Tatiana"
print(name)
if 3 > 2:
print("It works!")
if 5 > 2:
print("5 is indeed greater than 2")
else:
print("5 is not greater than 2")
name = 'Tatiana'
if name == 'Ola':
print('Hey Ola!')
elif name == 'Tatiana':
print('Hey Tatiana!')
else:
print('Hey anonymous!')
def hi():
print('Hi there!')... | Python | 25 | 15.36 | 36 | /Testdatei.py | 0.578049 | 0.558537 |
yueyoum/smoke | refs/heads/master | import sys
from wsgiref.simple_server import make_server
sys.path.append('..')
from app import App
from smoke.exceptions import EmailExceptionMiddleware
def exception_func_1():
return exception_func_2()
def exception_func_2():
return exception_func_3()
def exception_func_3():
return 1 / 0
app = Email... | Python | 28 | 17.142857 | 53 | /test/mail_exception_test.py | 0.69685 | 0.649606 |
yueyoum/smoke | refs/heads/master | class App(object):
def __init__(self, hook_func=None):
self.hook_func = hook_func
def __call__(self, environ, start_response):
html = """<html>
<body><table>{0}</table></body>
</html>"""
def _get_env(k, v):
return """<tr><td>{0}</td><td>{1}</td></tr>""".form... | Python | 31 | 27.67742 | 83 | /test/app.py | 0.506187 | 0.488189 |
yueyoum/smoke | refs/heads/master | # -*- coding: utf-8 -*-
import sys
import traceback
class ExceptionMiddleware(object):
def __init__(self, wrap_app, smoke_html=False):
self.wrap_app = wrap_app
self.smoke_html = smoke_html
def __call__(self, environ, start_response):
try:
return self.wrap_app(environ, sta... | Python | 87 | 32.379311 | 102 | /smoke/exceptions.py | 0.543546 | 0.540448 |
yueyoum/smoke | refs/heads/master | from mail import send_mail
| Python | 1 | 26 | 26 | /smoke/functional/__init__.py | 0.814815 | 0.814815 |
vkhvorostianyi/airflow_practice | refs/heads/master | from datetime import timedelta, datetime
import json
import time
import os
import airflow
from urllib.request import urlopen
import pandas as pd
import http.client
import configparser
from airflow import DAG
from airflow.operators.bash_operator import BashOperator
from airflow.operators.dummy_operator import DummyOper... | Python | 124 | 32.209679 | 124 | /dags/tiktok_dag.py | 0.56338 | 0.558038 |
Pudit/FarewellSI126 | refs/heads/main | #import libraries
from bs4 import BeautifulSoup
from urllib.request import urlopen
import urllib.error
import pandas as pd
#define func to find subfolder
def find_folder(student_id: int):
if student_id < 1 :
return None
elif student_id <= 50 :
return "001-050"
elif student_id <= 100 :
... | Python | 120 | 23.883333 | 94 | /find_all_sites.py | 0.635664 | 0.570759 |
Pudit/FarewellSI126 | refs/heads/main | #import libraries
from selenium import webdriver
from selenium.webdriver.common.by import By
import time
from datetime import datetime
import pandas as pd
#path for webdriver
driverpath = "PATH for your chromedriver"
#load data from csv file
df = pd.read_csv("si126_namelist.csv")
urllist = list(df[df.GSX == True].for... | Python | 52 | 30.057692 | 205 | /write_mirrors.py | 0.687693 | 0.66914 |
Jegajeeth/res-req-in-fast-api | refs/heads/main | from fastapi import FastAPI
from fastapi.responses import HTMLResponse as hr
from fastapi.responses import RedirectResponse as rr
from fastapi.responses import FileResponse
app = FastAPI()
file_path="TinDog-start-masrter2/index.html"
@app.get("/")
async def rout():
return FileResponse(file_path)
... | Python | 30 | 19.799999 | 52 | /app.py | 0.642202 | 0.637615 |
steveyeh987/Data-Science | refs/heads/master | import sys
import ssl
import urllib
import matplotlib.pyplot as plt
def Parse_File(link):
context = ssl._create_unverified_context()
f = urllib.request.urlopen(link, context=context)
data = f.read().decode('utf-8').split('\n')
e = [i.split(',') for i in data[2:7]]
a = [i.split(',') for i in data[... | Python | 112 | 33.839287 | 113 | /hw1/hw1.py | 0.512912 | 0.47865 |
sainarasimhayandamuri/LOGS-ANALYSIS-1 | refs/heads/master | #! /usr/bin/env python3
import psycopg2
import time
def connects():
return psycopg2.connect("dbname=news")
data1="select title,views from article_view limit 3"
data2="select * from author_view"
data3="select to_char(date,'Mon DD,YYYY') as date,err_prc from err_perc where err_prc>1.0"
def popular_article(data1):
... | Python | 51 | 25.411764 | 90 | /newsdata.py | 0.62426 | 0.60429 |
shrued/webscraping-playground | refs/heads/master | import requests
from bs4 import BeautifulSoup
response = requests.get(
url="https://en.wikipedia.org/wiki/Toronto_Stock_Exchange",
)
soup = BeautifulSoup(response.content, 'html.parser')
table = soup.find_all('table')
print(table) | Python | 10 | 22.4 | 60 | /scrape.py | 0.763949 | 0.759657 |
JeyFernandez/Crud-en-python | refs/heads/main | from tkinter import ttk
from tkinter import *
import sqlite3
class Product:
db_name = 'matricula.db'
def __init__(self, box):
self.box=box
self.box.title('Registro De Estudiante')
frame = LabelFrame(self.box, text='Datos del estudiante')
frame.grid(row = 0, column = 0... | Python | 89 | 30.157303 | 99 | /S_R_T.py | 0.572872 | 0.555556 |
garrettroth/Metaverse-Sicariis | refs/heads/main | import tweepy
from tweepy import OAuthHandler
import re
class TwitterClient(object):
'''
Twitter Class for grabbing Tweets
'''
def __init__(self):
'''
Initialization Method
'''
#Keys and Tokens from the Twitter Dev Console
consumer_key = 'osoPe1vbrj... | Python | 81 | 30.888889 | 102 | /twitter_api.py | 0.525169 | 0.520285 |
jerry5841314/Ensemble-Pytorch | refs/heads/master | import os
import time
import logging
def set_logger(log_file=None, log_console_level="info", log_file_level=None):
"""Bind the default logger with console and file stream output."""
def _get_level(level):
if level.lower() == 'debug':
return logging.DEBUG
elif level.lower() == 'inf... | Python | 65 | 31.276922 | 77 | /torchensemble/utils/logging.py | 0.557197 | 0.557197 |
jerry5841314/Ensemble-Pytorch | refs/heads/master | import torch
import pytest
import numpy as np
import torch.nn as nn
from torch.utils.data import TensorDataset, DataLoader
from torchensemble import FastGeometricClassifier as clf
from torchensemble import FastGeometricRegressor as reg
from torchensemble.utils.logging import set_logger
set_logger("pytest_fast_geomet... | Python | 85 | 26.435293 | 77 | /torchensemble/tests/test_fast_geometric.py | 0.653087 | 0.635935 |
fvicaria/fv-sectools | refs/heads/main | #!/usr/bin/env python
from distutils.core import setup
setup(name='fv-sectools',
description='A set of IP-based security checks for websites and applications',
long_description=open('README.rst').read(),
version='0.1dev',
author='F Vicaria',
author_email='fvicaria@hotmail.com',
url=... | Python | 15 | 29.533333 | 84 | /setup.py | 0.617904 | 0.60917 |
ljbelenky/murphy | refs/heads/master | from math import cos, sin, tan, atan, radians
import matplotlib.pyplot as plt
import numpy as np
from copy import deepcopy
from Murphy.link import Link
from Murphy.bedframe import Bedframe
from Murphy.murphy import Murphy
import sys
import pickle
class MurphyBed():
'''The MurphyBed Class represents a collection of... | Python | 173 | 40.468208 | 180 | /src/murphy.py | 0.616757 | 0.600864 |
ljbelenky/murphy | refs/heads/master | import numpy as np
from math import radians, sin, cos
import matplotlib.pyplot as plt
from sklearn.linear_model import LinearRegression as LR
class Bedframe():
def __init__(self, x,y, thickness, length, margin, angle):
'''Design elements'''
self.t = thickness
self.l = length
self.ma... | Python | 138 | 33.586956 | 131 | /src/Murphy/bedframe.py | 0.575199 | 0.552995 |
ljbelenky/murphy | refs/heads/master |
from math import sin, cos, radians, atan
import numpy as np
import matplotlib.pyplot as plt
class Link():
def __init__(self, x, y, length, width, angle, color, bedframe, attachment = None):
self.x, self.y = x, y
self.length, self.width = length, width
self.angle = angle
self.color ... | Python | 119 | 34.722691 | 147 | /src/Murphy/link.py | 0.532926 | 0.511994 |
ljbelenky/murphy | refs/heads/master | class Point:
def __init__(self, x, y):
self.x = x
self.y = y
def distance(self, other):
if isinstance(other, Point):
return self._distance_to_point(other)
elif isinstance(other, LineSegment):
return self._distance_to_line(other)
else:
... | Python | 88 | 24.511364 | 71 | /src/Murphy/geometric_objects.py | 0.524933 | 0.498219 |
ljbelenky/murphy | refs/heads/master | class Murphy():
'''The Murphy Object represents a bed assembly at a particular angle'''
learning_rate = -.2
threshold = .001
def __init__(self, bedframe, A_link, B_link):
''' Basic structure'''
self.bedframe = bedframe
self.A = A_link
self.B = B_link
@property
de... | Python | 43 | 47.162792 | 115 | /src/Murphy/murphy.py | 0.585707 | 0.572187 |
Asritha-Reddy/5TASK | refs/heads/master | str = input("Enter a string: ")
def Dictionary(i):
dictionary = {}
for letter in i:
dictionary[letter] = 1 + dictionary.get(letter, 0)
return dictionary
def most_frequent(str):
alphabets = [letter.lower() for letter in str if letter.isalpha()]
dictionary = Dictionary(alphabets)... | Python | 20 | 25 | 70 | /frequency.py | 0.625461 | 0.621771 |
kstandvoss/TFCA | refs/heads/master | from argparse import Namespace
import co2_dataset
import os
import time
# Settings
data_path = 'CO2/monthly_in_situ_c... | Python | 41 | 37.439026 | 151 | /run.py | 0.528553 | 0.502538 |
kstandvoss/TFCA | refs/heads/master | # coding: utf-8
import nengo
import nengo_dl
import tensorflow as tf
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
from scipy import signal
import argparse
import pdb
def main(args):
co2_data = pd.read_csv(args.data_path, usecols=[0,4,5,6,7,8,9])
co2_data.columns = ['Date', 'standar... | Python | 350 | 39.488571 | 176 | /co2_dataset.py | 0.564595 | 0.550131 |
mclain98021/FredwareBinTools | refs/heads/master | #!/usr/local/bin/python
from os.path import expanduser
execfile(expanduser('~/python/evm2003/brp/wizard.py')) | Python | 5 | 21.4 | 54 | /brpwizard | 0.765766 | 0.72973 |
mclain98021/FredwareBinTools | refs/heads/master | #!/usr/bin/python
'''
Apache log analysis script for Amazon Code challenge.
July 2nd 2016 by Fred McLain.
Copyright (C) 2016 Fred McLain, all rights reserved.
high level language of your choice (e.g. Python/Ruby/Perl)
The right fit language appears to be Python, so I'm going with that even though I'm a Java develope... | Python | 173 | 36.682079 | 219 | /Amazon_log_analizer/ApacheLogParse.py | 0.657923 | 0.621261 |
J4ME5s/guess-the-number | refs/heads/master | basic.show_string("Think of a number between 1 to 10")
basic.show_string("Input your answer here")
input.button_is_pressed(Button.A)
basic.show_string("The answer was...")
basic.show_number(randint(1, 10))
| Python | 5 | 40.200001 | 54 | /main.py | 0.747573 | 0.718447 |
prakharg24/review_classifier_non_neural | refs/heads/master | import json
import codecs
import random
from sklearn.feature_extraction.text import CountVectorizer
from nltk.stem.snowball import SnowballStemmer
from sklearn.naive_bayes import MultinomialNB
import numpy as np
from sklearn import metrics
import numpy as np
from sklearn import svm
from sklearn.feature_extrac... | Python | 129 | 22.085272 | 59 | /final.py | 0.585507 | 0.573913 |
Powercoders-International/ft-web-dev | refs/heads/main | from json import loads
from django.http import JsonResponse
from django.http import HttpResponseNotAllowed
def view_articles(request):
""" Handles GET and POST requests for a collection of articles.
curl --include \
http://localhost:8000/shop/articles/
curl --include \
--request POST \
... | Python | 60 | 24.700001 | 68 | /05-django/solutions/exercise-2-static/shop/views.py | 0.594034 | 0.577173 |
Powercoders-International/ft-web-dev | refs/heads/main | from django.db.models import Model
from django.db.models import CharField
class Article(Model):
name = CharField(max_length=50)
| Python | 6 | 21.333334 | 38 | /05-django/solutions/exercise-3-models/shop/models.py | 0.768657 | 0.753731 |
Powercoders-International/ft-web-dev | refs/heads/main | from shop.views import ArticleViewSet
from rest_framework.routers import DefaultRouter
router = DefaultRouter()
router.register('articles', ArticleViewSet)
urlpatterns = router.urls
| Python | 7 | 25.285715 | 48 | /05-django/solutions/exercise-5-filters/shop/urls.py | 0.826087 | 0.826087 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.