repo_name stringlengths 6 97 | path stringlengths 3 341 | text stringlengths 8 1.02M |
|---|---|---|
lycantropos/seidel | tests/integration_tests/points_tests/strategies.py | from hypothesis import strategies
from tests.strategies import (floats,
to_bound_with_ported_points_pair)
from tests.utils import (MAX_VALUE,
MIN_VALUE)
floats = floats
scales = strategies.integers(MIN_VALUE, MAX_VALUE)
points_pairs = strategies.builds(to_bound_w... |
lycantropos/seidel | tests/ported_tests/bounding_box_tests/test_copy.py | <gh_stars>1-10
import copy
from hypothesis import given
from seidel.bounding_box import BoundingBox
from . import strategies
@given(strategies.bounding_boxes)
def test_shallow(bounding_box: BoundingBox) -> None:
result = copy.copy(bounding_box)
assert result is not bounding_box
assert result == boundin... |
lycantropos/seidel | tests/ported_tests/edge_tests/test_equals.py | from typing import Tuple
from hypothesis import given
from seidel.edge import Edge
from tests.utils import (equivalence,
implication)
from . import strategies
@given(strategies.edges)
def test_reflexivity(edge: Edge) -> None:
assert edge == edge
@given(strategies.edges_pairs)
def test... |
lycantropos/seidel | tests/ported_tests/bounding_box_tests/strategies.py | <filename>tests/ported_tests/bounding_box_tests/strategies.py
from typing import Tuple
from hypothesis import strategies
from seidel.bounding_box import BoundingBox
from seidel.hints import Coordinate
from seidel.point import Point
from tests.strategies import (coordinates_strategies,
co... |
lycantropos/seidel | tests/integration_tests/trapezoidal_maps_tests/strategies.py | from hypothesis_geometry import planar
from hypothesis_geometry.hints import Contour
from tests.strategies import floats
from tests.utils import (BoundPoint,
BoundPortedPointsListsPair,
PortedPoint)
def to_bound_with_ported_contours(raw: Contour) -> BoundPortedPoints... |
lycantropos/seidel | seidel/leaf.py | <reponame>lycantropos/seidel
from reprit.base import generate_repr
from .edge import Edge
from .node import Node
from .point import Point
from .trapezoid import Trapezoid
class Leaf(Node):
__slots__ = 'trapezoid',
def __init__(self, trapezoid: Trapezoid) -> None:
super().__init__()
self.trap... |
lycantropos/seidel | tests/bind_tests/x_node_tests/test_initialization.py | <filename>tests/bind_tests/x_node_tests/test_initialization.py
from _seidel import (Node,
Point,
XNode)
from hypothesis import given
from . import strategies
@given(strategies.points, strategies.nodes, strategies.nodes)
def test_basic(point: Point, left: Node, right: Node) -... |
lycantropos/seidel | tests/integration_tests/trapezoidal_maps_tests/test_build_graph.py | <gh_stars>1-10
from _seidel import build_graph as bound_build_graph
from hypothesis import given
from seidel.trapezoidal_map import build_graph as ported_build_graph
from tests.utils import (BoundPortedPointsListsPair,
are_bound_ported_nodes_equal)
from . import strategies
@given(strategies.... |
lycantropos/seidel | tests/integration_tests/edges_tests/test_orientation_with.py | <filename>tests/integration_tests/edges_tests/test_orientation_with.py
from hypothesis import given
from tests.utils import (BoundPortedEdgesPair,
BoundPortedPointsPair)
from . import strategies
@given(strategies.edges_pairs, strategies.points_pairs)
def test_basic(edges_pair: BoundPortedEdg... |
lycantropos/seidel | tests/integration_tests/x_nodes_tests/test_equals.py | from hypothesis import given
from tests.utils import (BoundPortedXNodesPair,
equivalence)
from . import strategies
@given(strategies.x_nodes_pairs, strategies.x_nodes_pairs)
def test_basic(first_x_nodes_pair: BoundPortedXNodesPair,
second_x_nodes_pair: BoundPortedXNodesPair) -... |
lycantropos/seidel | tests/bind_tests/leaf_tests/test_equals.py | from _seidel import Leaf
from hypothesis import given
from tests.utils import (equivalence,
implication)
from . import strategies
@given(strategies.leaves)
def test_reflexivity(leaf: Leaf) -> None:
assert leaf == leaf
@given(strategies.leaves, strategies.leaves)
def test_symmetry(first... |
lycantropos/seidel | tests/integration_tests/leaves_tests/test_pickle.py | from hypothesis import given
from tests.utils import (BoundPortedLeavesPair,
are_bound_ported_leaves_equal,
pickle_round_trip)
from . import strategies
@given(strategies.leaves_pairs)
def test_round_trip(leaves_pair: BoundPortedLeavesPair) -> None:
bound, ported ... |
lycantropos/seidel | seidel/trapezoidal_map.py | <filename>seidel/trapezoidal_map.py<gh_stars>1-10
import random
from typing import (List,
Sequence)
from .bounding_box import BoundingBox
from .edge import Edge
from .leaf import Leaf
from .node import Node
from .point import Point
from .trapezoid import Trapezoid
from .x_node import XNode
from .y_... |
lycantropos/seidel | tests/bind_tests/bounding_box_tests/strategies.py | <gh_stars>1-10
from _seidel import (BoundingBox,
Point)
from hypothesis import strategies
from tests.strategies import floats
booleans = strategies.booleans()
points = strategies.builds(Point, floats, floats)
bounding_boxes = strategies.builds(BoundingBox, booleans, points, points)
|
lycantropos/seidel | tests/ported_tests/edge_tests/test_initialization.py | from typing import Tuple
from hypothesis import given
from seidel.edge import Edge
from seidel.point import Point
from . import strategies
@given(strategies.sorted_points_pairs)
def test_basic(endpoints: Tuple[Point, Point]) -> None:
left, right = endpoints
result = Edge(left, right)
assert result.lef... |
lycantropos/seidel | tests/ported_tests/trapezoid_tests/test_pickle.py | from hypothesis import given
from seidel.trapezoid import Trapezoid
from tests.utils import pickle_round_trip
from . import strategies
@given(strategies.trapezoids)
def test_round_trip(trapezoid: Trapezoid) -> None:
assert pickle_round_trip(trapezoid) == trapezoid
|
lycantropos/seidel | tests/bind_tests/point_tests/test_difference.py | from _seidel import Point
from hypothesis import given
from tests.utils import equivalence
from . import strategies
@given(strategies.points, strategies.points)
def test_basic(left: Point, right: Point) -> None:
assert isinstance(left - right, Point)
@given(strategies.points, strategies.origins)
def test_right... |
lycantropos/seidel | seidel/point.py | <filename>seidel/point.py<gh_stars>1-10
from reprit.base import generate_repr
from .hints import Coordinate
class Point:
__slots__ = 'x', 'y'
def __init__(self, x: Coordinate, y: Coordinate) -> None:
self.x = x
self.y = y
__repr__ = generate_repr(__init__)
def __add__(self, other: ... |
lycantropos/seidel | tests/integration_tests/bounding_boxes_tests/test_expand.py | from hypothesis import given
from tests.utils import (BoundPortedBoundingBoxesPair,
BoundPortedPointsPair,
are_bound_ported_bounding_boxes_equal)
from . import strategies
@given(strategies.bounding_boxes_pairs, strategies.points_pairs)
def test_basic(bounding_boxes_p... |
lycantropos/seidel | tests/integration_tests/x_nodes_tests/test_pickle.py | from hypothesis import given
from tests.utils import (BoundPortedXNodesPair,
are_bound_ported_x_nodes_equal,
pickle_round_trip)
from . import strategies
@given(strategies.x_nodes_pairs)
def test_round_trip(x_nodes_pair: BoundPortedXNodesPair) -> None:
bound, port... |
lycantropos/seidel | tests/bind_tests/bounding_box_tests/test_initialization.py | <filename>tests/bind_tests/bounding_box_tests/test_initialization.py
from _seidel import (BoundingBox,
Point)
from hypothesis import given
from . import strategies
@given(strategies.booleans, strategies.points, strategies.points)
def test_basic(empty: bool, lower: Point, upper: Point) -> None:
... |
lycantropos/seidel | tests/ported_tests/trapezoid_tests/test_initialization.py | from typing import Tuple
from hypothesis import given
from seidel.edge import Edge
from seidel.point import Point
from seidel.trapezoid import Trapezoid
from . import strategies
@given(strategies.points_pairs_edges_pairs)
def test_basic(points_pair_edges_pair: Tuple[Point, Point, Edge, Edge]
) -> Non... |
lycantropos/seidel | tests/bind_tests/point_tests/test_is_right_of.py | from hypothesis import given
from seidel.point import Point
from tests.utils import implication
from . import strategies
@given(strategies.points, strategies.points)
def test_basic(first_point: Point, second_point: Point) -> None:
result = first_point.is_right_of(second_point)
assert isinstance(result, bool... |
lycantropos/seidel | tests/integration_tests/trapezoids_tests/test_initialization.py | <gh_stars>1-10
from typing import Tuple
from hypothesis import given
from tests.utils import (BoundPortedEdgesPair,
BoundPortedPointsPair,
BoundTrapezoid,
PortedTrapezoid,
are_bound_ported_trapezoids_equal)
from . impo... |
lycantropos/seidel | tests/integration_tests/points_tests/test_multiplication.py | <filename>tests/integration_tests/points_tests/test_multiplication.py
from hypothesis import given
from tests.utils import (BoundPortedPointsPair,
are_bound_ported_points_equal)
from . import strategies
@given(strategies.points_pairs, strategies.scales)
def test_basic(points_pair: BoundPorte... |
lycantropos/seidel | tests/integration_tests/leaves_tests/test_equals.py | <filename>tests/integration_tests/leaves_tests/test_equals.py
from hypothesis import given
from tests.utils import (BoundPortedLeavesPair,
equivalence)
from . import strategies
@given(strategies.leaves_pairs, strategies.leaves_pairs)
def test_basic(first_leaves_pair: BoundPortedLeavesPair,
... |
lycantropos/seidel | tests/bind_tests/point_tests/test_addition.py | <filename>tests/bind_tests/point_tests/test_addition.py<gh_stars>1-10
from _seidel import Point
from hypothesis import given
from . import strategies
@given(strategies.points, strategies.points)
def test_basic(left: Point, right: Point) -> None:
assert isinstance(left + right, Point)
@given(strategies.points, ... |
lycantropos/seidel | tests/integration_tests/y_nodes_tests/test_initialization.py | from hypothesis import given
from tests.utils import (BoundPortedEdgesPair,
BoundPortedNodesPair,
BoundYNode,
PortedYNode,
are_bound_ported_y_nodes_equal)
from . import strategies
@given(strategies.edges_pairs, strate... |
lycantropos/seidel | tests/ported_tests/trapezoid_tests/test_neighbours.py | from typing import Tuple
from _seidel import Trapezoid
from hypothesis import given
from . import strategies
@given(strategies.trapezoids_pairs)
def test_lower_left(trapezoids_pair: Tuple[Trapezoid, Trapezoid]) -> None:
first_trapezoid, second_trapezoid = trapezoids_pair
first_trapezoid.lower_left = second... |
lycantropos/seidel | tests/ported_tests/trapezoid_tests/strategies.py | from tests.strategies import (coordinates_strategies,
coordinates_to_ported_points_pairs_edges_pairs,
coordinates_to_ported_trapezoids,
to_pairs,
to_triplets)
points_pairs_edges_pairs = coordinates_s... |
lycantropos/seidel | tests/bind_tests/trapezoid_tests/strategies.py | from operator import (add,
ne)
from _seidel import (Edge,
Point,
Trapezoid)
from hypothesis import strategies
from tests.strategies import (floats,
to_pairs)
from tests.utils import (pack,
sort_point... |
lycantropos/seidel | tests/ported_tests/trapezoid_tests/test_copy.py | import copy
from hypothesis import given
from seidel.trapezoid import Trapezoid
from . import strategies
@given(strategies.trapezoids)
def test_shallow(trapezoid: Trapezoid) -> None:
result = copy.copy(trapezoid)
assert result is not trapezoid
assert result == trapezoid
@given(strategies.trapezoids)
... |
lycantropos/seidel | tests/bind_tests/y_node_tests/test_copy.py | import copy
from _seidel import YNode
from hypothesis import given
from . import strategies
@given(strategies.y_nodes)
def test_shallow(y_node: YNode) -> None:
result = copy.copy(y_node)
assert result is not y_node
assert result == y_node
@given(strategies.y_nodes)
def test_deep(y_node: YNode) -> Non... |
lycantropos/seidel | tests/integration_tests/nodes_tests/test_search_point.py | from hypothesis import given
from tests.utils import (BoundPortedNodesPair,
BoundPortedPointsPair,
are_bound_ported_nodes_equal)
from . import strategies
@given(strategies.nodes_pairs, strategies.points_pairs)
def test_basic(nodes_pair: BoundPortedNodesPair,
... |
lycantropos/seidel | tests/bind_tests/trapezoid_tests/test_equals.py | <reponame>lycantropos/seidel
from _seidel import Trapezoid
from hypothesis import given
from tests.utils import (equivalence,
implication)
from . import strategies
@given(strategies.trapezoids)
def test_reflexivity(trapezoid: Trapezoid) -> None:
assert trapezoid == trapezoid
@given(str... |
lycantropos/seidel | seidel/edge.py | <filename>seidel/edge.py<gh_stars>1-10
import math
from reprit.base import generate_repr
from .hints import Coordinate
from .point import Point
class Edge:
__slots__ = 'left', 'right'
def __init__(self, left: Point, right: Point) -> None:
assert right.is_right_of(left), 'Incorrect endpoints order'
... |
lycantropos/seidel | tests/ported_tests/leaf_tests/strategies.py | from tests.strategies import (coordinates_strategies,
coordinates_to_ported_leaves,
coordinates_to_ported_trapezoids,
to_pairs,
to_triplets)
trapezoids = coordinates_strategies.flatmap(coordinates_to... |
lycantropos/seidel | tests/bind_tests/edge_tests/test_orientation_with.py | <gh_stars>1-10
from _seidel import (Edge,
Point)
from hypothesis import given
from . import strategies
@given(strategies.edges, strategies.points)
def test_basic(edge: Edge, point: Point) -> None:
assert edge.orientation_with(point) in (-1, 0, 1)
@given(strategies.edges)
def test_endpoints... |
lycantropos/seidel | tests/integration_tests/bounding_boxes_tests/test_add.py | from hypothesis import given
from tests.utils import (BoundPortedBoundingBoxesPair,
BoundPortedPointsListsPair,
are_bound_ported_bounding_boxes_equal)
from . import strategies
@given(strategies.bounding_boxes_pairs, strategies.points_lists_pairs)
def test_basic(bound... |
lycantropos/seidel | tests/strategies/factories.py | <filename>tests/strategies/factories.py
from functools import partial
from operator import add
from typing import Tuple
from hypothesis import strategies
from seidel.hints import Coordinate
from tests.utils import (BoundBoundingBox,
BoundEdge,
BoundLeaf,
... |
lycantropos/seidel | tests/bind_tests/point_tests/test_equals.py | from _seidel import Point
from hypothesis import given
from tests.utils import (equivalence,
implication)
from . import strategies
@given(strategies.points)
def test_reflexivity(point: Point) -> None:
assert point == point
@given(strategies.points, strategies.points)
def test_symmetry(... |
lycantropos/seidel | tests/bind_tests/leaf_tests/test_initialization.py | from _seidel import (Leaf,
Trapezoid)
from hypothesis import given
from . import strategies
@given(strategies.trapezoids)
def test_basic(trapezoid: Trapezoid) -> None:
result = Leaf(trapezoid)
assert result.trapezoid == trapezoid
assert result.trapezoid.trapezoid_node == result
|
lycantropos/seidel | tests/integration_tests/trapezoids_tests/test_pickle.py | <reponame>lycantropos/seidel<filename>tests/integration_tests/trapezoids_tests/test_pickle.py<gh_stars>1-10
from hypothesis import given
from tests.utils import (BoundPortedTrapezoidsPair,
are_bound_ported_trapezoids_equal,
pickle_round_trip)
from . import strategies
... |
lycantropos/seidel | tests/ported_tests/point_tests/test_difference.py | <reponame>lycantropos/seidel<filename>tests/ported_tests/point_tests/test_difference.py
from typing import Tuple
from hypothesis import given
from seidel.point import Point
from tests.utils import equivalence
from . import strategies
@given(strategies.points_pairs)
def test_basic(points_pair: Tuple[Point, Point]) -... |
lycantropos/seidel | tests/bind_tests/y_node_tests/test_pickle.py | <reponame>lycantropos/seidel
from _seidel import YNode
from hypothesis import given
from tests.utils import pickle_round_trip
from . import strategies
@given(strategies.y_nodes)
def test_round_trip(y_node: YNode) -> None:
assert pickle_round_trip(y_node) == y_node
|
lycantropos/seidel | tests/ported_tests/x_node_tests/strategies.py | from tests.strategies import (coordinates_strategies,
coordinates_to_ported_points_with_nodes_pairs,
coordinates_to_ported_x_nodes,
to_pairs,
to_triplets)
points_with_nodes_pairs = coordinates_strate... |
lycantropos/seidel | tests/ported_tests/leaf_tests/test_copy.py | <filename>tests/ported_tests/leaf_tests/test_copy.py
import copy
from hypothesis import given
from seidel.leaf import Leaf
from . import strategies
@given(strategies.leaves)
def test_shallow(leaf: Leaf) -> None:
result = copy.copy(leaf)
assert result is not leaf
assert result == leaf
@given(strategie... |
lycantropos/seidel | tests/integration_tests/y_nodes_tests/test_copy.py | import copy
from hypothesis import given
from tests.utils import (BoundPortedYNodesPair,
are_bound_ported_y_nodes_equal)
from . import strategies
@given(strategies.y_nodes_pairs)
def test_shallow(y_nodes_pair: BoundPortedYNodesPair) -> None:
bound, ported = y_nodes_pair
assert are_... |
lycantropos/seidel | tests/ported_tests/point_tests/test_is_right_of.py | <filename>tests/ported_tests/point_tests/test_is_right_of.py
from typing import Tuple
from hypothesis import given
from seidel.point import Point
from tests.utils import implication
from . import strategies
@given(strategies.points_pairs)
def test_basic(points_pair: Tuple[Point, Point]) -> None:
first_point, se... |
lycantropos/seidel | tests/integration_tests/x_nodes_tests/test_copy.py | <reponame>lycantropos/seidel<filename>tests/integration_tests/x_nodes_tests/test_copy.py
import copy
from hypothesis import given
from tests.utils import (BoundPortedXNodesPair,
are_bound_ported_x_nodes_equal)
from . import strategies
@given(strategies.x_nodes_pairs)
def test_shallow(x_node... |
lycantropos/seidel | seidel/bounding_box.py | <reponame>lycantropos/seidel<filename>seidel/bounding_box.py<gh_stars>1-10
from copy import copy
from reprit.base import generate_repr
from .point import Point
class BoundingBox:
__slots__ = 'empty', 'lower', 'upper'
def __init__(self, empty: bool, lower: Point, upper: Point) -> None:
self.empty = ... |
lycantropos/seidel | tests/ported_tests/leaf_tests/test_initialization.py | from hypothesis import given
from seidel.leaf import Leaf
from seidel.trapezoid import Trapezoid
from . import strategies
@given(strategies.trapezoids)
def test_basic(trapezoid: Trapezoid) -> None:
result = Leaf(trapezoid)
assert result.trapezoid == trapezoid
assert result.trapezoid.trapezoid_node == re... |
lycantropos/seidel | tests/bind_tests/bounding_box_tests/test_pickle.py | <gh_stars>1-10
from _seidel import BoundingBox
from hypothesis import given
from tests.utils import pickle_round_trip
from . import strategies
@given(strategies.bounding_boxes)
def test_round_trip(bounding_box: BoundingBox) -> None:
assert pickle_round_trip(bounding_box) == bounding_box
|
liaocm/LLBPM | bpm.py | #!/usr/bin/env python3
import io, sys, argparse
import json
from random import randint, choice, random
def main(fname, options):
try:
fd = io.open(fname, 'r')
content = fd.read()
fd.close()
notes = json.loads(content)
except BaseException:
sys.exit("Error loading or parsing the JSON file.")
... |
Elizandtech/pets_mysql | pets.py | <gh_stars>0
from flask import Flask, render_template, request, redirect
from mysqlconnection import connectToMySQL
app=Flask(__name__)
@app.route('/')
def root_route():
mysql = connectToMySQL("pets_flask")
pets = mysql.query_db("SELECT * FROM pets;")
print(pets)
return render_template("pets.html", all... |
juliendelaunay35000/anchors | anchor/predictSentiment.py | <gh_stars>0
import pandas as pd
import pickle
import os
import sklearn
# Load Machine Learning Models
print("Load Machine Learning Models")
dirname = os.path.dirname(os.path.abspath(__file__))
with open(os.path.join(dirname,'models','svm.pkl'), 'rb') as f1:
svc = pickle.load(f1)
with open(os.path.join(dirname,'mod... |
juliendelaunay35000/anchors | anchor/anchor_text.py | <filename>anchor/anchor_text.py
import utils
import anchor_base
import anchor_explanation
import numpy as np
import json
import os
import string
import sys
from io import open
import co_occurrence_matrix as co_occ
os.environ['SPACY_WARNING_IGNORE'] = 'W008'
# Python3 hack
try:
UNICODE_EXISTS = bool(type(unicode))
... |
juliendelaunay35000/anchors | anchor/anchor_on_tabular_data.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Wed Feb 5 14:30:36 2020
@author: jdelauna
"""
from __future__ import print_function
import numpy as np
np.random.seed(1)
import sklearn
import sklearn.ensemble
from sklearn.neural_network import MLPClassifier
import sklearn.linear_model
from sklearn impor... |
juliendelaunay35000/anchors | anchor/anchor_tabular.py | import anchor_base
import anchor_explanation
import utils
import lime
import lime.lime_tabular
import collections
import sklearn
import numpy as np
import os
import copy
import string
from io import open
import json
def id_generator(size=15):
"""Helper function to generate random div ids. This is useful for embedd... |
juliendelaunay35000/anchors | setup.py | <reponame>juliendelaunay35000/anchors<filename>setup.py
from setuptools import setup
setup(name='anchors',
version='0.0.1.0',
description='Anchor explanations for machine learning models',
url='https://github.com/juliendelaunay35000/anchors',
author='<NAME>',
author_email='<EMAIL>',
... |
juliendelaunay35000/anchors | anchor/load_tweets.py | <filename>anchor/load_tweets.py<gh_stars>0
import csv
import numpy as np
import pandas as pd
import emoji
from sklearn.naive_bayes import MultinomialNB
from sklearn.model_selection import cross_val_score
from sklearn.metrics import multilabel_confusion_matrix, accuracy_score, f1_score, jaccard_score, classification_rep... |
juliendelaunay35000/anchors | anchor/transform_data.py | <gh_stars>0
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Fri Feb 7 17:37:47 2020
@author: jdelauna
"""
fichier = open("../datasets/titanic/titanic.data", "w")
with open("../datasets/titanic/new_test_train.csv") as f:
boolean = True
for line in f:
if boolean:
boolean ... |
juliendelaunay35000/anchors | anchor/generate_dataset.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Tue Feb 11 17:54:12 2020
@author: jdelauna
"""
from sklearn.datasets import make_blobs, make_moons, make_circles
from matplotlib import pyplot
from pandas import DataFrame
import numpy as np
import re
import csv
from scipy.special import expit
from sklearn... |
juliendelaunay35000/anchors | anchor/anchor_for_text.py | <reponame>juliendelaunay35000/anchors
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Wed Feb 5 14:53:51 2020
@author: jdelauna
"""
from __future__ import print_function
import os
import os.path
import numpy as np
import sklearn
import sklearn.model_selection
import sklearn.linear_model
import sklearn.... |
kikyo91/Ecocyc-Database-Parsing | Ecocyc_Parse/__init__.py | from .ecocyc_parse import *
|
kikyo91/Ecocyc-Database-Parsing | Ecocyc_Parse/ecocyc_parse.py | <gh_stars>0
import numpy as np
import pandas as pd
import os
def parse_dat(file):
"""
Description:
Parsing EcoCyc .dat file into a pandas dataframe.
Input:
file - (‘string’) .dat file path.
Output:
dat_df - (pandas.DataFrame) a dataframe where each row is an instance, and each c... |
GoLorry/python-quickbooks | quickbooks/objects/estimate.py | <reponame>GoLorry/python-quickbooks
from six import python_2_unicode_compatible
from .base import CustomField, Ref, CustomerMemo, Address, EmailAddress, QuickbooksManagedObject, \
LinkedTxnMixin, QuickbooksTransactionEntity, LinkedTxn
from .tax import TxnTaxDetail
from .detailline import DetailLine, SalesItemLine, ... |
GoLorry/python-quickbooks | quickbooks/objects/creditmemo.py | <filename>quickbooks/objects/creditmemo.py
from six import python_2_unicode_compatible
from quickbooks.objects.detailline import SalesItemLine, SubtotalLine, DiscountLine, DescriptionLine, DetailLine
from .base import Address, EmailAddress, Ref, CustomField, CustomerMemo, QuickbooksManagedObject, \
LinkedTxnMixin,... |
GoLorry/python-quickbooks | quickbooks/objects/refundreceipt.py | <gh_stars>1-10
from six import python_2_unicode_compatible
from .base import Ref, CustomField, QuickbooksManagedObject, \
LinkedTxnMixin, QuickbooksTransactionEntity, LinkedTxn, Address, EmailAddress
from .tax import TxnTaxDetail
from .detailline import DetailLine
from ..mixins import DeleteMixin
@python_2_unicod... |
GoLorry/python-quickbooks | tests/unit/objects/test_detailline.py | <reponame>GoLorry/python-quickbooks
import unittest
from quickbooks.objects.detailline import SalesItemLineDetail, DiscountOverride, DetailLine, SubtotalLineDetail, \
DiscountLineDetail, SubtotalLine, DescriptionLineDetail, DescriptionLine, SalesItemLine, DiscountLine, GroupLine, \
AccountBasedExpenseLineDetai... |
GoLorry/python-quickbooks | quickbooks/objects/term.py | from six import python_2_unicode_compatible
from .base import QuickbooksManagedObject, QuickbooksTransactionEntity
@python_2_unicode_compatible
class Term(QuickbooksManagedObject, QuickbooksTransactionEntity):
"""
QBO definition: The Term entity represents the terms under which a sale is made, typically expre... |
GoLorry/python-quickbooks | quickbooks/objects/vendor.py | <reponame>GoLorry/python-quickbooks
from six import python_2_unicode_compatible
from .base import Address, PhoneNumber, EmailAddress, WebAddress, Ref, QuickbooksBaseObject, \
QuickbooksManagedObject, QuickbooksTransactionEntity
class ContactInfo(QuickbooksBaseObject):
class_dict = {
"Telephone": Phone... |
GoLorry/python-quickbooks | quickbooks/objects/attachable.py | <filename>quickbooks/objects/attachable.py<gh_stars>1-10
from six import python_2_unicode_compatible
from .base import Ref, QuickbooksManagedObject, QuickbooksTransactionEntity, AttachableRef
from ..client import QuickBooks
from ..mixins import DeleteMixin
@python_2_unicode_compatible
class Attachable(DeleteMixin, Qu... |
cutz-j/Python-for-data-analysis | day6-4[twitter&W2V].py | <filename>day6-4[twitter&W2V].py
import codecs
from bs4 import BeautifulSoup
from konlpy.tag import Twitter
from gensim.models import word2vec
# W2V
fp=codecs.open("D:/DataAnalysis/BEXX0003.txt", "r", encoding='utf-16')
soup=BeautifulSoup(fp, 'html.parser')
#print(soup)
# html > text
body=soup.select_one("body > tex... |
cutz-j/Python-for-data-analysis | bayes.py | <filename>bayes.py
import math, sys
from konlpy.tag import Okt
class BayesianFilter:
def __init__(self):
self.words=set()
self.word_dict={}
self.category_dict={}
def fit(self, text, category):
'''
텍스트를 읽어 학습
'''
pos=self.split(text)
for w... |
cutz-j/Python-for-data-analysis | day1-1[formatting].py | a=4.2E7 # E7 -> 지수(4.2 * 10^7)
print(a)
a=4.2E-7 # E-7 -> 10^-7
print(a)
print(7/4)
print(7//4) # 몫만 return
print(7%4) # 나머지만 return
# 다중주석 / 제어문자
msg="""
life is \ntoo short
you need Python
"""
print(msg)
print("-"*100)
# string index output
a="Life"
print(a[0])
print(a[-2])
print(a[1:3])
# formatting
print("I at... |
cutz-j/Python-for-data-analysis | day5-2[loginweb].py | <filename>day5-2[loginweb].py
import requests
from urllib.parse import urljoin
from bs4 import BeautifulSoup
import re
# 로그인 후 내 정보 출력
# http://www.hanbit.co.kr
# http://www.hanbit.co.kr/member/login.html
# http://www.hanbit.co.kr/myhanbit/myhanbit.html
# login box: id="m_id", pw="<PASSWORD>"
# login_proc.php(검증)
url... |
cutz-j/Python-for-data-analysis | cgv_other.py | <gh_stars>0
from bs4 import BeautifulSoup
import urllib.request as req
import os.path
url="http://www.cgv.co.kr/movies/"
savename="movie.xml"
if not os.path.exists(savename) :
req.urlretrieve(url,savename)
xml=open(savename,mode="r",encoding="utf-8")
soup=BeautifulSoup(xml,"html.parser")
info ={}
i=0
chart=soup.fin... |
cutz-j/Python-for-data-analysis | day5-6[JSON].py | <filename>day5-6[JSON].py
import urllib.request as req
from bs4 import BeautifulSoup
import os.path
url="http://www.kma.go.kr/weather/forecast/mid-term-rss3.jsp?stnID=108"
saveName="forecast.xml"
if not os.path.exists(saveName):
req.urlretrieve(url, saveName)
xml=open(saveName, "r", encoding='utf-8').read()
soup=... |
cutz-j/Python-for-data-analysis | day2-1[comprehesion].py | <reponame>cutz-j/Python-for-data-analysis<filename>day2-1[comprehesion].py
# comprehension
res= [num*2 for num in [1,2,3,4]]
print(res)
res= [num*2 for num in [1,2,3,4] if num%2==0]
print(res)
res=[x*y for x in range(2,5) for y in range(1,10)]
print(res)
a=[1,2,3,4,5]
res=[i*2 for i in a if i%2==1]
print(res)
res=[]... |
cutz-j/Python-for-data-analysis | day8-3[TiwtterNouns].py | from konlpy.tag import Twitter
from collections import Counter
import codecs
def get_Noun(text, count=30):
twit=Twitter()
noun=twit.nouns(text)
return noun
def rank(list):
rank=Counter(list)
rankList=rank.most_common(20)
return_list=[{'tag':word, 'count':cnt} for word, cnt in rankList]
... |
cutz-j/Python-for-data-analysis | scrapping_cgv.py | from bs4 import BeautifulSoup
from selenium import webdriver
import time
#http://www.cgv.co.kr/movies/
#contents > div.wrap-movie-chart > div.sect-movie-chart > ol:nth-child(2) > li:nth-child(1) > div.box-contents > a > strong
#contents > div.wrap-movie-chart > div.sect-movie-chart > ol:nth-child(2) > li:nth-child(1) ... |
cutz-j/Python-for-data-analysis | day3-1[regxgroupping].py | # 정규식
"""
\d: 숫자 = [0-9]
\D: 숫자가 아닌것 =[^0-9]
"""
import re
pat=re.compile("[a-z]")
res=pat.match("3test")
print(res)
text="에러 1004 : 레퍼런스 에러 \n 에러 1247 : 코드 오류"
text2="기타 사항은 전화번호 : 02-1234-5678 로 연락주세요"
text3="에러 1247 : 레퍼런스 에러\n 에러 32: 코드 오류"
text4="기타 사항은 전화번호 : 02-1234-5678 로 연락주세요"
regex=re.compile("에러 21247")... |
cutz-j/Python-for-data-analysis | day7-1.py | import numpy as np
# 레벤슈타인거리알고리즘
# 두 단어 간의 편집거리 계산
def calc_dist(word1, word2):
lenA=len(word1)
lenB=len(word2)
matrix=np.zeros((lenA+1, lenB+1))
if word1==word2:
return matrix[lenA][lenB]
if word1=="": return lenB
elif word2=="": return lenA
for i in range(lenA+1):
matrix[... |
cutz-j/Python-for-data-analysis | day7-2[N-gram].py | <filename>day7-2[N-gram].py
import re
# N-gram 클래스 불러오기
def split(text, n):
pattern=re.compile("[\W\w\s]{1,%d}" %n)
res=pattern.findall(text)
if len(res[-1])!=n:
res[-1]=text[len(text)-n:len(text)+1]
return res
def gram(sa, sb, num):
saList=split(sa, num)
sbList=split(sb... |
cutz-j/Python-for-data-analysis | president word.py | <gh_stars>0
from bs4 import BeautifulSoup
import urllib.request as req
import re
from konlpy.tag import Twitter
from collections import Counter
from matplotlib import pyplot as plt
import matplotlib
from matplotlib import font_manager, rc
import platform
if platform.system()=="Windows":
font_name=font_manager.Font... |
cutz-j/Python-for-data-analysis | codeEx/day5-4[binaryfile].py | filename="a.bin"
data=100
with open(filename, "wb") as f:
f.write(bytearray[data]) |
cutz-j/Python-for-data-analysis | day5-3[webbook].py | <filename>day5-3[webbook].py
import re
import urllib.request as req
import urllib.parse
from bs4 import BeautifulSoup
# 도서목록&가격 가져오기
#http://book.daum.net/search/bookSearch.do?query=%ED%8C%8C%EC%9D%B4%EC%8D%AC
#http://book.daum.net/search/bookSearch.do?query=%EC%9E%90%EB%B0%94
##page_body > form:nth-child(6) > ul > l... |
cutz-j/Python-for-data-analysis | day2-3[pickle&glob].py | <filename>day2-3[pickle&glob].py<gh_stars>0
import pickle
f=open("sleep.txt","wb") #write, binary
data={1:"big", 2:"data"}
pickle.dump(data, f)
f.close()
f=open("sleep.txt","rb")
print(pickle.load(f))
# glob
import glob
print(glob.glob("d*"))
# 난수생성기
import random
print(random.random())
# Q1
|
cutz-j/Python-for-data-analysis | codeEx/p160.py | # -*- coding: utf-8 -*-
"""
Created on Sun Aug 5 14:24:36 2018
@author: 403-10
"""
from pandas import Series, DataFrame
aSeries=Series([1,2,3,"a"])
bSeries=Series([4,5,6,"b"])
print(aSeries+bSeries)
sumSeries=aSeries+bSeries
sumSeries.name="sum"
sumSeries.index.name="category"
print(sumSeries)
aDict={'a':[1,2,3,4,... |
cutz-j/Python-for-data-analysis | codeEx/p116.py | <reponame>cutz-j/Python-for-data-analysis<gh_stars>0
# numpy ndarray
import numpy as np
data=np.random.randn(2,3)
data1=[6,7.5,8,0,1]
arr1=np.array(data1)
print(arr1)
# array= 다차원 동일자료형
np.arange(15)
arrayList=np.arange(10)
numList=[]
for i in range(0,10):
numList.append(i)
numList[5:8]
arrayList[5:8]=12
print(... |
cutz-j/Python-for-data-analysis | day2-2[enumerate].py | <gh_stars>0
print(abs(-2))
print(all([2,5,'a',0]))
print(any([None,"",[],0]))
name=['gildong', 'sunsin', 'sejong']
for n in name:
print(n)
# enumerate & eval
dictA={}
for n, name in enumerate(['gildong','sunsin','sejong']):
dictA[n]=name
for n in enumerate(['gildong','sunsin','sejong']):
print(n[1])
... |
cutz-j/Python-for-data-analysis | day8.4[matplotlib].py | from matplotlib import pyplot as plt
import matplotlib
from matplotlib import font_manager, rc
import platform
if platform.system()=="Windows":
font_name=font_manager.FontProperties(fname="c:/Windows/Fonts/malgun.ttf").get_name()
rc('font', family=font_name)
matplotlib.rcParams['axes.unicode_minus']=False
f=... |
Syu-syusan/internship | microservices/svc/echo/run.py | <gh_stars>0
import asyncio
import conf
import server
if __name__ == "__main__":
asyncio.run(server.run(host=conf.APP_IP_ADDRESS, port=conf.APP_PORT))
|
Syu-syusan/internship | gen/py/greeter/v1/greeter_pb2.py | # -*- coding: utf-8 -*-
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: greeter/v1/greeter.proto
"""Generated protocol buffer code."""
from google.protobuf import descriptor as _descriptor
from google.protobuf import message as _message
from google.protobuf import reflection as _reflection
from goo... |
Syu-syusan/internship | microservices/svc/echo/handler/__init__.py | from .echo import Echo # noqa: F401
|
Syu-syusan/internship | microservices/svc/echo/server.py | <reponame>Syu-syusan/internship
from grpclib.server import Server
from grpclib.utils import graceful_exit
from handler import Echo
async def run(host: str = "0.0.0.0", port: int = 5050) -> None:
server = Server([Echo()])
with graceful_exit([server]):
await server.start(host, port)
print(f"Ser... |
Syu-syusan/internship | gen/py/echo/v1/echo_pb2.py | # -*- coding: utf-8 -*-
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: echo/v1/echo.proto
"""Generated protocol buffer code."""
from google.protobuf import descriptor as _descriptor
from google.protobuf import message as _message
from google.protobuf import reflection as _reflection
from google.pr... |
Syu-syusan/internship | microservices/svc/echo/handler/echo.py | from echo.v1.echo_grpc import EchoBase
from echo.v1.echo_pb2 import EchoRequest, EchoResponse
from grpclib.server import Stream
class Echo(EchoBase):
async def Echo(self, stream: Stream[EchoRequest, EchoResponse]) -> None:
req = await stream.recv_message()
assert req is not None
res = Ech... |
Syu-syusan/internship | gen/py/echo/v1/echo_grpc.py | <gh_stars>0
# Generated by the Protocol Buffers compiler. DO NOT EDIT!
# source: echo/v1/echo.proto
# plugin: grpclib.plugin.main
import abc
import typing
import grpclib.const
import grpclib.client
if typing.TYPE_CHECKING:
import grpclib.server
import google.api.annotations_pb2
import echo.v1.echo_pb2
class Ech... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.