repo_name
stringlengths
6
97
path
stringlengths
3
341
text
stringlengths
8
1.02M
prolidorpenrvapiroldon/cppclasshelper-sublime-text-plugin
method_generator/exceptions.py
class ClassValidationException(Exception): pass
prolidorpenrvapiroldon/cppclasshelper-sublime-text-plugin
method_generator/klass/klass.py
<reponame>prolidorpenrvapiroldon/cppclasshelper-sublime-text-plugin class Klass: """ represents a C++ class """ def __init__(self, name): self._name = name self._methods = [] self._template = None self._namespace = None @property def name(self): return s...
prolidorpenrvapiroldon/cppclasshelper-sublime-text-plugin
tests/test_parser.py
<reponame>prolidorpenrvapiroldon/cppclasshelper-sublime-text-plugin from method_generator.parser import ClassParser from method_generator.tokenizer import ClassTokenizer from method_generator.exceptions import ClassValidationException import os def read_files_as_tokenizers(): test_files = [ os.path.abspat...
prolidorpenrvapiroldon/cppclasshelper-sublime-text-plugin
tests/test_tokenizer.py
from method_generator.tokenizer import ClassTokenizer from method_generator.exceptions import ClassValidationException import os def read_files_as_tokenizers(): test_files = [ os.path.abspath("tests/files/User.hpp"), os.path.abspath("tests/files/Window.hpp") ] files_list = [] for fil...
prolidorpenrvapiroldon/cppclasshelper-sublime-text-plugin
method_generator/klass/datatype.py
class Datatype: """ represents a datatype """ def __init__(self, name): self._name = name @property def name(self): return self._name @name.setter def name(self, name): self._name = name def __str__(self): """ renders datatype name ...
prolidorpenrvapiroldon/cppclasshelper-sublime-text-plugin
method_generator/klass/__init__.py
from .datatype import Datatype from .template import Template from .klass import Klass from .method import Method from .template_type import TemplateType
prolidorpenrvapiroldon/cppclasshelper-sublime-text-plugin
method_generator/parser.py
<gh_stars>1-10 from .klass import * class ClassParser: @classmethod def parse(cls, input_obj): """ create python classes from tokenized JSON object :param input_obj: dict :return: Klass """ klass = Klass(input_obj["name"]) klass.namespace = input_obj[...
prolidorpenrvapiroldon/cppclasshelper-sublime-text-plugin
method_generator/klass/method.py
<filename>method_generator/klass/method.py class Method: """ represents a C++ class method """ def __init__(self): self._name = None self._arguments = [] self._return_type = None self._template = None self._class = None self._is_const = False self...
prolidorpenrvapiroldon/cppclasshelper-sublime-text-plugin
tests/test_generator.py
<filename>tests/test_generator.py<gh_stars>1-10 from method_generator.generator import Generator from method_generator.exceptions import ClassValidationException import os def read_files_as_method_generators(): test_files = [ os.path.abspath("tests/files/User.hpp"), os.path.abspath("tests/files/Wi...
prolidorpenrvapiroldon/cppclasshelper-sublime-text-plugin
method_generator/klass/template_type.py
from .datatype import Datatype class TemplateType(Datatype): """ represents a template type """ def __init__(self, typename, name): super(TemplateType, self).__init__(name) self._typename = typename @property def typename(self): return self._typename @typename.s...
prolidorpenrvapiroldon/cppclasshelper-sublime-text-plugin
template.py
import os, sublime class Template: def __init__(self, name): self._template = None self._name = name self.file = None def load(self, filename): # load template file self.file = open(filename) # reading template self._template = self.file.read() self.file.close() def render(self, **values):...
prolidorpenrvapiroldon/cppclasshelper-sublime-text-plugin
method_generator/__init__.py
<filename>method_generator/__init__.py from .klass.klass import Klass from .klass.datatype import Datatype from .klass.method import Method from .klass.template import Template from .klass.template_type import TemplateType
prolidorpenrvapiroldon/cppclasshelper-sublime-text-plugin
method_generator/klass/template.py
<reponame>prolidorpenrvapiroldon/cppclasshelper-sublime-text-plugin<filename>method_generator/klass/template.py<gh_stars>1-10 class Template: """ represents a C++ class or method template """ def __init__(self): self._template_types = [] @property def template_types(self): retu...
prolidorpenrvapiroldon/cppclasshelper-sublime-text-plugin
tests/class_generator.py
import sys, os, json sys.path.append(os.path.dirname(os.path.dirname(os.path.realpath(__file__)))) from method_generator import klass as c def test(): pass class ClassGenerator: def __init__(self, filename): self.filename = filename self.klass = None with open(self.filename, 'r') ...
prolidorpenrvapiroldon/cppclasshelper-sublime-text-plugin
method_generator/generator.py
<reponame>prolidorpenrvapiroldon/cppclasshelper-sublime-text-plugin from .tokenizer import * from .parser import * class Generator: """ generates all class method definitions """ DEFINITIONS = 1 NAMES = 2 def __init__(self, source_code): self._source_code = source_code def _gene...
Prabhav55223/Flipkart-PORTRAY
app.py
<reponame>Prabhav55223/Flipkart-PORTRAY<filename>app.py # -----------------------------------------------------------------PORTRAY----------------------------------------------------------------------# # AUTHORS # ...
Prabhav55223/Flipkart-PORTRAY
trends.py
# -----------------------------------------------------------------PORTRAY----------------------------------------------------------------------# # AUTHORS # <NAME> -> <EMAIL> # ...
Prabhav55223/Flipkart-PORTRAY
main.py
# -----------------------------------------------------------------PORTRAY----------------------------------------------------------------------# # AUTHORS # <NAME> -> <EMAIL> # ...
lgw2/lgw2.github.io
_teaching/csci127-summer-2020/readings/activities/etch-a-sketch.py
import turtle import random window = turtle.Screen() square = turtle.Turtle() square.speed(0) square.hideturtle() square.up() square.goto(-200, 200) square.down() for i in range(4): square.forward(50) square.right(90) square.up() square.goto(-205, 205) square.write("Change Color") pen...
lgw2/lgw2.github.io
_teaching/csci127-summer-2020/readings/activities/nested-lists.py
populations = [["California", 38332521], ["Texas", 26448193], ["New York", 19651127], ["Florida", 19552860], ["Illinois", 12882135], ["Pennsylvania", 12773801], ["Ohio", 11570808], ["Georgia", 9992167], ...
lgw2/lgw2.github.io
_teaching/csci127-summer-2020/labs/lab11.py
<gh_stars>0 import matplotlib.pyplot as plt import pandas as pd # ------------------------------------------------- # CSCI 127, Lab 11 | # June 23, 2020 | # Your Name | # ---------------------------------------------...
lgw2/lgw2.github.io
_teaching/csci127-summer-2020/readings/activities/date.py
<filename>_teaching/csci127-summer-2020/readings/activities/date.py class Date: """Date class for representing and manipulating dates""" def __init__(self, month, day, year): """A constructor method that sets the month, day and year""" self.month = month self.day = day se...
lgw2/lgw2.github.io
_teaching/csci127-summer-2020/labs/lab9.py
<gh_stars>0 import numpy as np import random # ------------------------------------------------- # CSCI 127, Lab 9 # June 18, 2020 # Your Name # ------------------------------------------------- class Die: def __init__(self, sides): """A constructor method to create a die""" self.sid...
lgw2/lgw2.github.io
_teaching/csci127-summer-2020/readings/activities/demo.py
def alternate_case (sentence, start = 0): result = "" upper = True for i in range(len(sentence)): if i < start: result = result + sentence[i] elif upper: result = result + sentence[i].upper() else: result = result + sentence[i].lower() uppe...
lgw2/lgw2.github.io
_teaching/csci127-summer-2020/readings/activities/racing-turtles.py
import turtle import random window = turtle.Screen() racer_1 = turtle.Turtle() racer_1.up() racer_1.shape("turtle") racer_1.color(random.random(), random.random(), random.random()) racer_1.goto(-200, 100) racer_1.down() racer_1.stamp() racer_2 = turtle.Turtle() racer_2.up() racer_2.shape("turtle") ra...
lgw2/lgw2.github.io
_teaching/csci127-summer-2020/readings/bridger_snowfall.py
<gh_stars>0 import pandas as pd import matplotlib.pyplot as plt # Create Data -------------------------- # http://www.onthesnow.com/montana/bridger-bowl/historical-snowfall.html years = [2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019] # bridger bowl year total_snowfall = [253, 304, 388, 265, 283,...
lgw2/lgw2.github.io
_teaching/csci127-summer-2020/readings/snow_report.py
<filename>_teaching/csci127-summer-2020/readings/snow_report.py<gh_stars>0 import matplotlib.pyplot as plt years = [2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018] # bridger bowl year total_snowfall = [253, 304, 388, 265, 283, 209, 194, 271, 177] # inches largest_snowfall = [19, 16, 19, 25, 20, 14, 13, 20, 1...
lgw2/lgw2.github.io
_teaching/csci127-summer-2020/labs/lab10.py
<reponame>lgw2/lgw2.github.io import numpy as np import matplotlib.pyplot as plt # ------------------------------------------------- # CSCI 127, Lab 10 | # June 19, 2020 | # Your Name | # ---------------------...
lgw2/lgw2.github.io
_teaching/csci127-summer-2020/readings/activities/diceSimulator.py
<reponame>lgw2/lgw2.github.io # -------------------------------------- # Simulate rolling 2 dice and plot the results. # -------------------------------------- import numpy as np import matplotlib.pyplot as plt # -------------------------------------- def generate_rolls(how_many): result = np.ndarray(h...
lgw2/lgw2.github.io
_teaching/csci127-summer-2020/labs/lab3.py
<reponame>lgw2/lgw2.github.io # -------------------------------------- # CSCI 127, Lab 3 | # May 28, 2020 | # -------------------------------------- # Calculate the length of a string | # using three techniques. | # ------------------------------------...
lgw2/lgw2.github.io
_teaching/csci127-summer-2020/readings/lesson1.py
import pandas as pd import matplotlib.pyplot as plt import sys # to determine Python version number import matplotlib # to determine Matplotlib version number print('Python version ' + sys.version) print('Pandas version ' + pd.__version__) print('Matplotlib version ' + matplotlib.__version__) print(...
lgw2/lgw2.github.io
_teaching/csci127-summer-2020/readings/activities/card_blackjack.py
class Card: """Card class for representing and manipulating one playing card""" def __init__(self, rank, suit): """A constructor method that sets the suit and rank""" self.suit = suit self.rank = rank self.value = self.assign_value(rank) def get_suit(self): """A rea...
lgw2/lgw2.github.io
_teaching/csci127-summer-2020/labs/lab7.py
<reponame>lgw2/lgw2.github.io # ----------------------------------------------------- # CSCI 127, Lab 7 # June 10, 2020 # Your Name # ----------------------------------------------------- # ----------------------------------------------------- # Do not change anything below this line # ----------------------...
lgw2/lgw2.github.io
_teaching/csci127-summer-2020/readings/activities/carddeck.py
class Card: """Card class for representing and manipulating one playing card""" def __init__(self, rank, suit): """A constructor method that sets the suit and rank""" self.suit = suit self.rank = rank def __str__(self): """Overrides the information used by the prin...
lgw2/lgw2.github.io
_teaching/csci127-summer-2020/readings/lesson2.py
import pandas as pd import matplotlib.pyplot as plt import numpy as np how_many = 1000 # number of submissions file_name = "jbd.csv" # file to write to and then read from # Create Data -------------------------- names = ['HughJ', 'Ryan', 'Justin', 'Sam', 'Michael', 'Grace', 'Courtney', '...
lgw2/lgw2.github.io
_teaching/csci127-summer-2019/labs/lab6.py
# -------------------------------------- # CSCI 127, Lab 7 | # February 28, 2019 | # Your Name | # -------------------------------------- # The missing functions go here. # -------------------------------------- def main(): dictionary ...
lgw2/lgw2.github.io
_teaching/csci127-summer-2020/readings/activities/loop.py
print("Loop with continue\n") for i in range(2000, 2017): if i % 7 == 0: continue print(i) print("\nLoop with break\n") for i in range(2000, 2017): if i % 7 == 0: break print(i) print("\nDemonstration finished")
lgw2/lgw2.github.io
_teaching/csci127-summer-2020/readings/activities/card.py
<reponame>lgw2/lgw2.github.io class Card: """Card class for representing and manipulating one playing card""" def __init__(self, rank, suit): """A constructor method that sets the suit and rank""" self.suit = suit self.rank = rank self.value = self.assign_value(rank) ...
lgw2/lgw2.github.io
_teaching/csci127-summer-2020/readings/planets.py
<gh_stars>0 import pandas as pd import matplotlib.pyplot as plt # read in the data planets = pd.read_csv("planets.csv")
lgw2/lgw2.github.io
_teaching/csci127-summer-2020/assignments/weather.py
<reponame>lgw2/lgw2.github.io # -----------------------------------------+ # CSCI 127, Joy and Beauty of Data | # Program 3: Weather CSV Library | # Your Name(, Your Partner's Name) | # Last Modified: ??, 2019 | # -----------------------------------------+ # Provide a br...
lgw2/lgw2.github.io
_teaching/csci127-summer-2020/readings/quiz3.py
<filename>_teaching/csci127-summer-2020/readings/quiz3.py import matplotlib.pyplot as plt import pandas as pd data = pd.read_csv('billionaires.csv') # your code here
lgw2/lgw2.github.io
_teaching/csci127-summer-2020/readings/activities/draw_square.py
<reponame>lgw2/lgw2.github.io<gh_stars>0 import turtle def drawSquare(t, sz): """Make turtle t draw a square of with side sz.""" for i in range(4): t.forward(sz) t.left(90) wn = turtle.Screen() # Set up the window and its attributes wn.bgcolor("lightgreen") alex = turtle.Turtle()...
lgw2/lgw2.github.io
_teaching/csci127-summer-2019/labs/lab3.py
# -------------------------------------- # CSCI 127, Lab 3 | # June 13, 2019 | # Partner names | # -------------------------------------- # Calculate how many z's are in a | # sentence using three techniques. | # ------------------------...
lgw2/lgw2.github.io
_teaching/csci127-summer-2020/labs/taxes.py
# --------------------------------------- # CSCI 127, Joy and Beauty of Data | # Lab 2: Tax Calculator | # Your Name | # Date: | # --------------------------------------- # Calculate the amount of tax owed by an| # unmarried taxpayer in ta...
lgw2/lgw2.github.io
_teaching/csci127-summer-2020/readings/graph.py
<filename>_teaching/csci127-summer-2020/readings/graph.py<gh_stars>0 # -------------------------------------- # CSCI 127: Joy and Beauty of Data # MatPlotLib Introductory Example # -------------------------------------- import matplotlib.pyplot as plt import numpy as np import math # ---------------------------------...
lgw2/lgw2.github.io
_teaching/csci127-summer-2020/readings/activities/raven.py
import string # --------------------------- def keep_letters(filename): file = open(filename, "r") modified_text = "" for line in file: line = line.lower() for letter in line: if letter in string.ascii_lowercase: modified_text += letter file.close() re...
lgw2/lgw2.github.io
_teaching/csci127-summer-2020/readings/dungeons.py
# Object Oriented Programming - Inheritance Demo # <NAME> and <NAME> import random # ------------------------------------------------ class Character: """Common base class for any type of character""" def __init__(self, name, age, height, weight): """Constructor for a new Character""" ...
lgw2/lgw2.github.io
_teaching/csci127-summer-2020/readings/activities/madlib.py
# -------------------------------- # Joy and Beauty of Data # Authors: <NAME> and <NAME> # -------------------------------- # MadLib Exercise # -------------------------------- # Get User Input for MadLib Story adjective_1 = input("Enter an adjective: ") name_1 = input("Enter a name: ") number = input("E...
lgw2/lgw2.github.io
_teaching/csci127-summer-2020/readings/activities/key-events.py
import turtle window = turtle.Screen() drawer = turtle.Turtle() drawer.speed(0) def east(): drawer.setheading(0) drawer.forward(50) def north(): drawer.setheading(90) drawer.forward(50) def west(): drawer.setheading(180) drawer.forward(50) def south(): drawer.seth...
lgw2/lgw2.github.io
_teaching/csci127-summer-2020/readings/activities/blackjack.py
<gh_stars>0 import card # ----------------------- def evaluate(hand): result = 0 for one_card in hand: result += one_card.get_value() return result # ----------------------- def process_hand(hand): print("The processHand function needs to be completed") # --------------------...
lgw2/lgw2.github.io
_teaching/csci127-summer-2020/readings/activities/raven_words_updated.py
f = open('raven.txt', 'r') # create an empty dictionary count = {} for line in f: for word in line.split(): # remove punctuation word = word.replace('_', '').replace('"', '').replace(',', '').replace('.', '') word = word.replace('-', '').replace('?', '').replace('!', '').replace("'", "") ...
lgw2/lgw2.github.io
_teaching/csci127-summer-2020/assignments/program5.py
import numpy as np # --------------------------------------- # CSCI 127, Joy and Beauty of Data # Program 5: Eight Puzzle # Your Name # --------------------------------------- # A brief overview of the program. # --------------------------------------- class EightPuzzle: def __init__(self): self.solution...
lgw2/lgw2.github.io
_teaching/csci127-summer-2020/readings/activities/ml.py
# -------------------------------------- # Simple Machine Learning Demo # -------------------------------------- from sklearn import datasets, svm from sklearn.tree import DecisionTreeClassifier # -------------------------------------- def learn(classifier, dataset): n = len(dataset.data) classifier.fit(data...
lgw2/lgw2.github.io
_teaching/csci127-summer-2020/readings/activities/draw_tree.py
<filename>_teaching/csci127-summer-2020/readings/activities/draw_tree.py import turtle def tree(branchLen,t): if branchLen > 5: t.forward(branchLen) t.right(20) tree(branchLen-15,t) t.left(40) tree(branchLen-15,t) t.right(20) t.backward(branchLen) def main()...
lgw2/lgw2.github.io
_teaching/csci127-summer-2020/readings/activities/montana.py
import matplotlib.pyplot as plt import numpy as np # -------------------------------------- def read_file(file_name): """Read census data from a file""" years = [] populations = [] census_file = open(file_name, "r") for one_line in census_file: values = one_line.split() ...
lgw2/lgw2.github.io
_teaching/csci127-summer-2019/labs/lab5.py
# -------------------------------------- # CSCI 127, Lab 6 | # June 16, 2019 | # Your Name | # -------------------------------------- # The missing functions go here. # -------------------------------------- def main(file_name): ma...
lgw2/lgw2.github.io
_teaching/csci127-summer-2020/labs/etch-a-sketch.py
# -----------------------------------------+ # Your name | # CSCI 127, Lab 1 | # Last Updated: June 6, 2019 | # -----------------------------------------| # Modify an etch-a-sketch program. | # -----------------------------------------+...
lgw2/lgw2.github.io
_teaching/csci127-summer-2019/assignments/cribbage.py
<gh_stars>0 # -----------------------------------------+ # Your name | # CSCI 127, Program 2 | # Last Updated: ???, 2019 | # -----------------------------------------| # A simplified Cribbage scoring system. | # ------------------------------...
lgw2/lgw2.github.io
_teaching/csci127-summer-2020/assignments/pokedex.py
import string # --------------------------------------- # CSCI 127, Joy and Beauty of Data | # Program 4: Pokedex | # Your Name(, Your Partner's Name) | # Last Modified: ??, 2019 | # --------------------------------------- # A brief overview of the program. # ----------------...
lgw2/lgw2.github.io
_teaching/csci127-summer-2020/labs/lab8.py
<reponame>lgw2/lgw2.github.io<gh_stars>0 # ----------------------------------------------------- # CSCI 127, Lab 8 | # June 12, 2020 | # Your Name | # -----------------------------------------------------...
lgw2/lgw2.github.io
_teaching/csci127-summer-2020/readings/activities/np_practice.py
<filename>_teaching/csci127-summer-2020/readings/activities/np_practice.py # Create a one-dimensional array called v with 10 integers. # Each integer should be a random number between 1 and 100. # Create a new array which consists of the odd indices of # previously created array v. # Create a new array in backwards o...
lgw2/lgw2.github.io
_teaching/csci127-summer-2020/readings/activities/convert.py
<gh_stars>0 def convert(base_10_number, new_base): convert_string = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ" if base_10_number < new_base: return convert_string[base_10_number] else: return convert(base_10_number // new_base, new_base) + convert_string[base_10_number % new_base] prin...
lgw2/lgw2.github.io
_teaching/csci127-summer-2020/labs/lab4.py
<filename>_teaching/csci127-summer-2020/labs/lab4.py # -------------------------------------- # CSCI 127, Lab 4 # May 29, 2020 # Your Name # -------------------------------------- def process_season(season, games_played, points_earned): print("Season: " + str(season) + ", Games Played: " + str(games_played)...
lgw2/lgw2.github.io
_teaching/csci127-summer-2020/readings/activities/house.py
import turtle square = turtle.Turtle() square.hideturtle() rectangle = turtle.Turtle() rectangle.hideturtle() triangle = turtle.Turtle() triangle.hideturtle() square.up() square.goto(-50, 50) square.down() for side in range(4): square.forward(100) square.right(90) triangle.up() triangle....
lgw2/lgw2.github.io
_teaching/csci127-summer-2020/readings/activities/raven_words.py
<filename>_teaching/csci127-summer-2020/readings/activities/raven_words.py<gh_stars>0 f = open('raven.txt', 'r') for line in f: for word in line.split(): # remove punctuation word = word.replace('_', '').replace('"', '').replace(',', '').replace('.', '') word = word.replace('-', '').replac...
lgw2/lgw2.github.io
_teaching/csci127-summer-2019/labs/lab10.py
import numpy as np import matplotlib.pyplot as plt # ------------------------------------------------- # CSCI 127, Lab 10 | # July 1, 2019 | # Your Name | # ------------------------------------------------- ...
lgw2/lgw2.github.io
_teaching/csci127-summer-2020/readings/np_tutorial.py
<reponame>lgw2/lgw2.github.io import numpy as np # NumPy Tutorial a = np.array([2.0, 3.3, 5.8, 7.3]) print("a =\n", a) print("a.size =", a.size) print("a.ndim =", a.ndim) print("a.shape =", a.shape) print("a.dtype =", a.dtype) print() b = np.array([["naif", "brittany", "cooper", "joseph"], ...
lgw2/lgw2.github.io
_teaching/csci127-summer-2020/readings/activities/alternating.py
<reponame>lgw2/lgw2.github.io def alternating(list_of_ints): pass print(alternating([1, 2, 3, 4])) print(alternating([10, 11, 1, 12])) print(alternating([10, 21, 22, -5, 100, 101, 2]))
Tom-SW1/Politics-War-Formulas
content/spy_estimate/code/example.py
<filename>content/spy_estimate/code/example.py<gh_stars>0 import requests #get_nation = string ; tactician, arcane, covert = boolean def get_spy_count(get_nation, tactician, arcane, covert): safety = 1 #do not touch (changing will break) odds = 50 #do not touch (changing will break) min = 0 max = 60 while...
satorumpen/node-pdfium-native
third_party/pdfium/build/gyp_pdfium.py
<reponame>satorumpen/node-pdfium-native # Copyright 2014 PDFium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. import os path = os.path.abspath(os.path.split(__file__)[0]) execfile(os.path.join(path, 'gyp_pdfium'))
satorumpen/node-pdfium-native
binding.gyp
<gh_stars>10-100 { 'includes': [ './common.gypi' ], 'target_defaults': { 'defines' : [ 'PNG_PREFIX', 'PNGPREFIX_H', 'PNG_USE_READ_MACROS', ], # 'include_dirs': [ # '<(DEPTH)/third_party/pdfium', # '<(DEPTH)/third_party/pdfium/third_party/freetype/include', # ], ...
satorumpen/node-pdfium-native
third_party/pdfium/testing/gtest.gyp
# Copyright 2014 PDFium authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. # # Original code from V8, original license was: # Copyright 2014 the V8 project authors. All rights reserved. # Use of this source code is governed by a BSD-style ...
supro200/cisco-sdwan-query-tool
sdnetsql.py
<reponame>supro200/cisco-sdwan-query-tool import json import csv import getpass import argparse import sys import pandas as pd import numpy as np import requests from datetime import datetime from tqdm import tqdm # progress bar from colorama import init, Fore, Style # colored screen output from sshtunnel import SSHT...
supro200/cisco-sdwan-query-tool
rest_api_lib.py
<reponame>supro200/cisco-sdwan-query-tool import requests import json import sys class rest_api_lib: def __init__(self, vmanage_ip, vmanage_port, username, password): self.vmanage_ip = vmanage_ip self.vmanage_port = vmanage_port self.session = {} self.login(username, password) ...
Frikilinux/arigram
arigram/__init__.py
""" Terminal client for telegram """ __version__ = "0.1.1"
Frikilinux/arigram
arigram/colours.py
<reponame>Frikilinux/arigram import curses DEFAULT_FG = curses.COLOR_WHITE DEFAULT_BG = curses.COLOR_BLACK COLOR_PAIRS = {(10, 10): 0} COLOR_PAIRS = {} # colors black = curses.COLOR_BLACK blue = curses.COLOR_BLUE cyan = curses.COLOR_CYAN green = curses.COLOR_GREEN magenta = curses.COLOR_MAGENTA red = curses.COLOR_RED...
Frikilinux/arigram
arigram/utils.py
import base64 import curses import functools import hashlib import logging import mailcap import math import mimetypes import os import random import shlex import struct import subprocess import sys import types import unicodedata from datetime import datetime from functools import lru_cache from logging.handlers impor...
Frikilinux/arigram
arigram/config.py
<filename>arigram/config.py """ Every parameter (except for CONFIG_FILE) can be overwritten by external config file """ import mailcap import os import platform import runpy from typing import Any, Dict, List, Optional, Tuple _os_name = platform.system() _linux = "Linux" _global_mailcap = mailcap.getcaps() CONFIG_DI...
Frikilinux/arigram
arigram/exceptions.py
<reponame>Frikilinux/arigram class KeyBoundError(Exception): """Exception to raise when a key is already bound""" pass
Frikilinux/arigram
setup.py
<reponame>Frikilinux/arigram from setuptools import setup import arigram with open("README.md", "r") as fh: readme = fh.read() setup( long_description=readme, long_description_content_type="text/markdown", name="arigram", version=arigram.__version__, description="A fork of tg -- a hackable t...
kompotkot/RevitApi-RoomMassing
RoomMassingScript.py
<filename>RoomMassingScript.py #__doc__ = 'Print the full path to the central model (if model is workshared).' # IMPORTS import clr import System clr.AddReference('RevitAPI') clr.AddReference('RevitAPIUI') clr.AddReference("RevitServices") clr.AddReference("RevitNodes") from Autodesk.Revit.DB import * from Autodesk...
CodyJohnsonCHL/dfm_models
dfm_models/scripts/generate_BCs_gcm.py
#!/usr/bin/env python # coding: utf-8 # version 0.1 2020/01/08 -- <NAME> import argparse from pathlib import Path import cartopy.crs as ccrs import cartopy.feature as cfeature import cmocean.cm as cmo import matplotlib.pyplot as plt import numpy as np import pandas as pd import xarray as xr # functions # def wr...
CodyJohnsonCHL/dfm_models
dfm_models/_internal.py
import pathlib from datetime import datetime as dt def validate_COOPs_loaded(Obs): """Simple validation that COOPs stations are properly loaded""" try: if not bool(Obs.COOPs): raise TypeError( "Load COOPs stations before downloading predicted water levels." ) ...
CodyJohnsonCHL/dfm_models
dfm_models/utils/io.py
"""Code for io and network calls <EMAIL> """ from pathlib import Path from tempfile import NamedTemporaryFile as tmp from urllib.error import HTTPError from urllib.request import urlretrieve import numpy as np import pandas as pd import xarray as xr from pydap.cas.get_cookies import setup_session from dfm_models._...
CodyJohnsonCHL/dfm_models
dfm_models/utils/openDA.py
"""Code for working with OpenDA <EMAIL> """ from datetime import datetime as dt def writeNoosTs(data, Location, x, y, Unit, fn): """write time series data in OpenDA ExchangeObject format (NOOS) data = pd.Series with datatime axis and value """ now = dt.now().strftime("%Y-%m-%d %H:%M") with o...
CodyJohnsonCHL/dfm_models
dfm_models/utils/observations.py
<reponame>CodyJohnsonCHL/dfm_models """Classes and functions for working with observational data. <EMAIL> """ import json from collections.abc import Iterable from tempfile import NamedTemporaryFile as tmp from urllib.error import HTTPError from urllib.request import urlretrieve import pandas as pd from dfm_models...
CodyJohnsonCHL/dfm_models
dfm_models/project/InitialConditions.py
<gh_stars>0 """Object representing FM model <EMAIL> """ import numpy as np from scipy.interpolate import LinearNDInterpolator def interp2mesh(da, mesh_data, mod180=False): """Interpolate variabel from Xarray DataArray to grid :params: da = DataArray of variable to interpolate mesh_data = X...
CodyJohnsonCHL/dfm_models
dfm_models/utils/calibration.py
"""Classes and functions for calibration. <EMAIL> """ import numpy as np def write_correction_file(corr_fn, correction_factors): """write out correction factors to Delft3D-FM readable forcing file :function: TODO :returns: TODO """ with open(corr_fn, "w") as f: for boundary_point in...
CodyJohnsonCHL/dfm_models
dfm_models/utils/analysis.py
<filename>dfm_models/utils/analysis.py """Analysis tools for comparing model results to observations <EMAIL> """ import pandas as pd import pytide from numpy import abs, angle from dfm_models._internal import validate_harcon def compute_harcon_error(Observations, Results): """Calculate statistics between COOP...
CodyJohnsonCHL/dfm_models
dfm_models/utils/metrics.py
<reponame>CodyJohnsonCHL/dfm_models from numpy import abs, nanmax, nanmean, nanmin, nanstd, nanvar, sqrt def rmse(model, ref): """ root mean square error. Ideal value is zero model = numerical solution of shape M by N ref = analytical solution or observations of shape M by N returns rmse """...
CodyJohnsonCHL/dfm_models
dfm_models/project/FMmodel.py
"""Object representing FM model <EMAIL> """ import re from collections.abc import Iterable import numpy as np import pandas as pd import pytide import xarray as xr from dfm_models._internal import validate_file, validate_project class Model: """Top-level object for organizing FM model input/output""" d...
CodyJohnsonCHL/dfm_models
dfm_models/project/BoundaryConditions.py
"""Object representing FM boundary conditions <EMAIL> """ import re import pandas as pd from dfm_models._internal import validate_file class Boundary: """Docstring for Boundary.""" def __init__(self): """TODO: to be defined. :Docstring for Boundary.: TODO """ class WaterLeve...
CodyJohnsonCHL/dfm_models
dfm_models/utils/visualization.py
<filename>dfm_models/utils/visualization.py """Visualization tools for comparing model results to observations <EMAIL> """ import geoviews as gv import geoviews.feature as gf import geoviews.tile_sources as gts import holoviews as hv import matplotlib.pyplot as plt import numpy as np from bokeh.models import HoverTo...
IsSveshuD/lab_5
Individual_1.py
<gh_stars>0 #!/usr/bin/env python3 # -*- coding: utf-8 -*- #Дано предложение. В нем слова разделены одним пробелом (символ «-» в предложении отсутствует). Верно ли, что число слов в предложении больше трех? import sys if __name__ == '__main__': s = input("Введите предложение: ") words = s.split(' ') if len...
IsSveshuD/lab_5
Individual_3.py
#!/usr/bin/env python3 # -*- coding^ utf-8 -*- #Дан текст, имеющий вид: « », где di – цифры ( ). Вычислить записанную в тексте алгебраическую сумму. s = '+' + input() print(sum([int(s[i : i + 2]) for i in range(0, len(s), 2)]))
IsSveshuD/lab_5
Individual_2.py
<gh_stars>0 #!/usr/bin/env python3 # -*- coding^ utf-8 -*- #Дано слово. Поменять местами его вторую и пятую буквы. s = input("Введите слово: ") r = s.split() d = [] for i in r: d.append(i[0] + i[4] + i[2] + i[3] + i[1] + i[5:]) print (d)
ChrisDryden/VerifHire
server.py
from web3 import Web3 from solc import compile_files # web3.py instance w3 = Web3(Web3.HTTPProvider("http://127.0.0.1:8545")) # compile all contract files contracts = compile_files(['user.sol', 'stringUtils.sol']) # separate main file and link file main_contract = contracts.pop("user.sol:userRecords") library_link = c...
locuslab/sdp_mrf
sdp_mrf/solvers.py
import numpy as np import time from abc import ABC, abstractmethod import sys, os from . import _solvers def get_string_from_vector(v): ''' Converts vector to string :param v: a numpy array with digits in 0-9 Returns: the string form of v ''' ret = "" for digit in v: assert digit >=...
locuslab/sdp_mrf
sdp_mrf/models.py
<reponame>locuslab/sdp_mrf from .solvers import find_solver class PottsModel(object): def __init__(self, A=None, h=None, k=None): ''' Instantiates a k-class Potts Model, with given coupling matrix A, biases h :param A: The coupling matrix. A symmetric numpy array of dimension (n, n) ...
locuslab/sdp_mrf
setup.py
<gh_stars>1-10 import os import sys DIR = os.path.abspath(os.path.dirname(__file__)) sys.path.append(os.path.join(DIR, "third_party", "pybind11")) from glob import glob from setuptools import setup from pybind11.setup_helpers import Pybind11Extension, build_ext # noqa: E402 del sys.path[-1] pkg_name = 'sdp_mrf' ext_...