profile
viewpoint
Matt Davis jiffyclub @populus-ai Bay Area, California http://penandpants.com

jiffyclub/cext23 36

Examples of Python C extensions that work on Python 2 and 3

jiffyclub/2015-07-06-scipy 14

Software Carpentry Workshop at SciPy 2015

jiffyclub/dc-python-meetup-nov-2012 14

Material for the Number Crunching in Python workshop.

ivanov/ipython-trainingwheels 4

A beginner student friendly profile for IPython notebook

abostroem/2014-09-10-LBL 3

LBL Lab Day 2014

jiffyclub/advent-of-code 1

Advent of Code 2017

GollumEvent

pull request commentNABSA/gbfs

Extending system_pricing_plans.json

Something that I don't think could be reflected in this model is Gig's scheme where they have several different pricing schemes and charge you whichever one would be lowest at the end of your rental: https://gigcarshare.com/rates/

josee-sabourin

comment created time in 16 days

Pull request review commentNABSA/gbfs

Extending system_pricing_plans.json

 Describes pricing for the system.  Field Name | Required | Type | Defines ---|---|---|----`plans` | Yes | Array | Array of objects as defined below.+`plans` | Yes | Array | Array of objects as defined below.<br /><br /> In the event of colliding plans, the earlier plan (ir order of the JSON file) takes precedence. \-&nbsp;`plan_id` | Yes | ID | Identifier for a pricing plan in the system.+\-&nbsp;`days` | Optional | Array | An array of abbreviations (first 3 letters) of English names of the days of the week when this plan is active. <br /><br /> Valid values are:<br /><br /><ul><li>`mon`</li><li>`tue`</li><li>`wed`</li><li>`thu`</li><li>`fri`</li><li>`sat`</li><li>`sun`</li></ul>If this field is empty, the plan does not vary depending on day of the week.+\-&nbsp;`months` | Optional | Array | An array of abbreviations (first 3 letters) of English names of the months of the year when this plan is active. <br /><br /> Valid values are: <br /><br /><ul><li>`jan`</li><li>`feb`</li><li>`mar`</li><li>`apr`</li><li>`may`</li><li>`jun`</li><li>`jul`</li><li>`aug`</li><li>`sep`</li><li>`oct`</li><li>`nov`</li><li>`dec`</li></ul>If this field is empty, the plan does not vary depending on month.+\-&nbsp;`start_time` | Conditionally Required | Time | Time of the day when this plan starts being active. <br /><br /> If this field is empty, the plan does not vary depending on time of day.<br /><br />Conditionally Required: `start_time` and `end_time` must both be populated, or both be omitted  - feeds cannot contain one field without the other.+\-&nbsp;`end_time` | Conditionally Required | Time | Time of the day when this plan stops being active. <br /><br /> If this field is empty, the plan does not vary depending on time of day.<br /><br />Conditionally Required: `start_time` and `end_time` must both be populated, or both be omitted  - feeds cannot contain one field without the other.+\-&nbsp;`vehicle_type_id` | Optional | Array | `vehicle_type_id` of the vehicle eligible for this pricing plan as described in [vehicle_types.json](#vehicle_typesjson-added-in-v21-rc).<br /><br />If this field is empty, the plan applies to all vehicle types defined in the dataset.<br /><br />In the case of a vehicle type being attributed to different plans, all plans associated with the vehicle type are valid.    \-&nbsp;`url` | Optional | URL | URL where the customer can learn more about this pricing plan. \-&nbsp;`name` | Yes | String | Name of this pricing plan. \-&nbsp;`currency` | Yes | String | Currency used to pay the fare. <br /><br /> This pricing is in ISO 4217 code: http://en.wikipedia.org/wiki/ISO_4217 <br />(e.g. `CAD` for Canadian dollars, `EUR` for euros, or `JPY` for Japanese yen.)-\-&nbsp;`price` | Yes | Non-negative float OR String | Fare price, in the unit specified by currency. If String, must be in decimal monetary value.+\-&nbsp;`price` | Yes | Non-negative float OR String | Fare price, in the unit specified by currency. If String, must be in decimal monetary value.<br /><br />In case of non-variable price, this field is the total price. In case of variable price, this field is the base price that is charged only once per trip (e.g., price for unlocking). See `variable_price` for details. \-&nbsp;`is_taxable` | Yes | Boolean | Will additional tax be added to the base price?<br /><br />`true` - Yes.<br />  `false` - No.  <br /><br />`false` may be used to indicate that tax is not charged or that tax is included in the base price. \-&nbsp;`description` | Yes | String | Customer-readable description of the pricing plan. This should include the duration, price, conditions, etc. that the publisher would like users to see.+\-&nbsp;`variable_price` | Optional | Array | Array of segments when `variable_unit` varies.<br /><br />The total variable price in the unit specified by the currency becomes the sum of prices issued of rate segments and flat segments.<br /><br /> If this array is not provided, there are no variable prices.+&emsp;\-&nbsp;`variable_unit` | Yes | Enum | Unit of the rate.<br /><br />Valid issues are:<br /><br /><ul><li>`km`</li><li>`min`</li><li>`hour`</li><li>`day`</li><li>`week`</li></ul>Each variable_unit can be used only once in the array `variable_price`.+&emsp;\-&nbsp;`rate_segments` | Conditionally Required | Array | Array of the rate in increasing order. Each `rate_segment` defines one rate per `variable_unit` of riding in the pricing plan currency. The variable price become the sum of `rate_segment` prices. A `rate_segment` price depends on the rate per `variable_unit` elapsed.<br /><br />At least one `rate_segment` or `flat_segment` is required.+&emsp;&emsp;\-&nbsp;`start` | Optional | Non-Negative Integer | Number of units that have to elapse before this segment starts applying.<br /><br />If this field is empty, the price issued from this segment is charged immediately upon rental.+&emsp;&emsp;\-&nbsp;`rate` | Yes | Float | Rate that serves to calculate the variable price based on the amount of variable unites. The rate is valid for the segment. Can be a negative number, which indicated that the traveller will receive a discount.+&emsp;\-&nbsp;`flat_segments` | Conditionally Required | Array | Array of flat prices in increasing order. Each segment defines the flat price and the interval of `variable_unit` of riding in the pricing plan currency, in which the flat price is reapplied.<br /><br />At least on `rate_segment` or `flat_segment` is required.+&emsp;&emsp;\-&nbsp;`price` | Yes | Float | Flat price charged per interval. Currency is defined by the `currency` field.+&emsp;&emsp;\-&nbsp;`interval` | Yes | Non-Negative Integer | Interval in `variable_unit` at which the price of this segment is charged.+&emsp;&emsp;\-&nbsp;`start` | Optional | Non-Negative Integer | Number of units that have to elapse before this segment starts applying.<br /><br />If this field is empty, the price issued from this segment is charged immediately upon rental.+\-&nbsp;`surge_pricing` | Optional | Non-Negative Float | Multiplier that is applied during period of increased demand. If this field is empty, there is no surge pricing.++Example:+This example demonstrates a pricing scheme that has a rate both by minute and by km. The user is charged $0.25 per km as well as $0.50 per minute. Both of these rates happen concurrently and are not dependent on one another. +```jsonc+{+  "plans": {+    "plan_id": "plan2",+    "start_time": "7:00:00",+    "end_time": "9:30:00",+    "vehicle_type_id": "def",+    "name": "Rush Hour Rate",+    "currency": "CAD",+    "price": 3,+    "is_taxable": true,+    "description": "$3 unlock fee, $0.25 per kilometer and $0.50 per minute",+    "variable_price": [+      {+        "variable_unit": "km",+        "rate_segments": {+          "start": 0,+          "rate": 0.25+        }+      },+      {+        "variable_unit": "minute",+        "rate_segments": {+          "start": 0,+          "rate": 0.5+        }+      }+    ]+  }+}+```++Example:++The user does not pay more than the base price for the first 10 km. After 10 km the user pays $1 per km. After 25 km the user pays $0.50 per km and an additional $3 every 5 km, the extension price, in addition to $0.50 per km. ++```jsonc+ "variable_price": {+   "variable_unit": "km",+   "rate_segments": [+     {+       "start": 10,+       "rate": 1+     },+     {+       "start": 25,+       "rate": 0.5+     }+   ]+   "flat_segments": [+     {+       "start": 25,+       "price": 3,+       "interval": 5,+     }+   ]+ }

Would this be functionally the same thing? rate_segments seems like a special case of flat_segments where the interval is 1.

"variable_price": [
    {
        "variable_unit": "km",
        "flat_segments": [
            {
                "start": 10,
                "price": 1,
                "interval": 1
            },
            {
                "start": 25,
                "price": 0.5,
                "interval": 1
            }
        ]
    },
    {
        "variable_unit": "km",
        "flat_segments": [
            {
                "start": 25,
                "price": 3,
                "interval": 5
            }
        ]
    }
]
josee-sabourin

comment created time in 16 days

PullRequestReviewEvent

Pull request review commentNABSA/gbfs

Extending system_pricing_plans.json

 Describes pricing for the system.  Field Name | Required | Type | Defines ---|---|---|----`plans` | Yes | Array | Array of objects as defined below.+`plans` | Yes | Array | Array of objects as defined below.<br /><br /> In the event of colliding plans, the earlier plan (ir order of the JSON file) takes precedence. \-&nbsp;`plan_id` | Yes | ID | Identifier for a pricing plan in the system.+\-&nbsp;`days` | Optional | Array | An array of abbreviations (first 3 letters) of English names of the days of the week when this plan is active. <br /><br /> Valid values are:<br /><br /><ul><li>`mon`</li><li>`tue`</li><li>`wed`</li><li>`thu`</li><li>`fri`</li><li>`sat`</li><li>`sun`</li></ul>If this field is empty, the plan does not vary depending on day of the week.+\-&nbsp;`months` | Optional | Array | An array of abbreviations (first 3 letters) of English names of the months of the year when this plan is active. <br /><br /> Valid values are: <br /><br /><ul><li>`jan`</li><li>`feb`</li><li>`mar`</li><li>`apr`</li><li>`may`</li><li>`jun`</li><li>`jul`</li><li>`aug`</li><li>`sep`</li><li>`oct`</li><li>`nov`</li><li>`dec`</li></ul>If this field is empty, the plan does not vary depending on month.+\-&nbsp;`start_time` | Conditionally Required | Time | Time of the day when this plan starts being active. <br /><br /> If this field is empty, the plan does not vary depending on time of day.<br /><br />Conditionally Required: `start_time` and `end_time` must both be populated, or both be omitted  - feeds cannot contain one field without the other.+\-&nbsp;`end_time` | Conditionally Required | Time | Time of the day when this plan stops being active. <br /><br /> If this field is empty, the plan does not vary depending on time of day.<br /><br />Conditionally Required: `start_time` and `end_time` must both be populated, or both be omitted  - feeds cannot contain one field without the other.+\-&nbsp;`vehicle_type_id` | Optional | Array | `vehicle_type_id` of the vehicle eligible for this pricing plan as described in [vehicle_types.json](#vehicle_typesjson-added-in-v21-rc).<br /><br />If this field is empty, the plan applies to all vehicle types defined in the dataset.<br /><br />In the case of a vehicle type being attributed to different plans, all plans associated with the vehicle type are valid.    \-&nbsp;`url` | Optional | URL | URL where the customer can learn more about this pricing plan. \-&nbsp;`name` | Yes | String | Name of this pricing plan. \-&nbsp;`currency` | Yes | String | Currency used to pay the fare. <br /><br /> This pricing is in ISO 4217 code: http://en.wikipedia.org/wiki/ISO_4217 <br />(e.g. `CAD` for Canadian dollars, `EUR` for euros, or `JPY` for Japanese yen.)-\-&nbsp;`price` | Yes | Non-negative float OR String | Fare price, in the unit specified by currency. If String, must be in decimal monetary value.+\-&nbsp;`price` | Yes | Non-negative float OR String | Fare price, in the unit specified by currency. If String, must be in decimal monetary value.<br /><br />In case of non-variable price, this field is the total price. In case of variable price, this field is the base price that is charged only once per trip (e.g., price for unlocking). See `variable_price` for details. \-&nbsp;`is_taxable` | Yes | Boolean | Will additional tax be added to the base price?<br /><br />`true` - Yes.<br />  `false` - No.  <br /><br />`false` may be used to indicate that tax is not charged or that tax is included in the base price. \-&nbsp;`description` | Yes | String | Customer-readable description of the pricing plan. This should include the duration, price, conditions, etc. that the publisher would like users to see.+\-&nbsp;`variable_price` | Optional | Array | Array of segments when `variable_unit` varies.<br /><br />The total variable price in the unit specified by the currency becomes the sum of prices issued of rate segments and flat segments.<br /><br /> If this array is not provided, there are no variable prices.+&emsp;\-&nbsp;`variable_unit` | Yes | Enum | Unit of the rate.<br /><br />Valid issues are:<br /><br /><ul><li>`km`</li><li>`min`</li><li>`hour`</li><li>`day`</li><li>`week`</li></ul>Each variable_unit can be used only once in the array `variable_price`.+&emsp;\-&nbsp;`rate_segments` | Conditionally Required | Array | Array of the rate in increasing order. Each `rate_segment` defines one rate per `variable_unit` of riding in the pricing plan currency. The variable price become the sum of `rate_segment` prices. A `rate_segment` price depends on the rate per `variable_unit` elapsed.<br /><br />At least one `rate_segment` or `flat_segment` is required.+&emsp;&emsp;\-&nbsp;`start` | Optional | Non-Negative Integer | Number of units that have to elapse before this segment starts applying.<br /><br />If this field is empty, the price issued from this segment is charged immediately upon rental.+&emsp;&emsp;\-&nbsp;`rate` | Yes | Float | Rate that serves to calculate the variable price based on the amount of variable unites. The rate is valid for the segment. Can be a negative number, which indicated that the traveller will receive a discount.+&emsp;\-&nbsp;`flat_segments` | Conditionally Required | Array | Array of flat prices in increasing order. Each segment defines the flat price and the interval of `variable_unit` of riding in the pricing plan currency, in which the flat price is reapplied.<br /><br />At least on `rate_segment` or `flat_segment` is required.+&emsp;&emsp;\-&nbsp;`price` | Yes | Float | Flat price charged per interval. Currency is defined by the `currency` field.+&emsp;&emsp;\-&nbsp;`interval` | Yes | Non-Negative Integer | Interval in `variable_unit` at which the price of this segment is charged.+&emsp;&emsp;\-&nbsp;`start` | Optional | Non-Negative Integer | Number of units that have to elapse before this segment starts applying.<br /><br />If this field is empty, the price issued from this segment is charged immediately upon rental.+\-&nbsp;`surge_pricing` | Optional | Non-Negative Float | Multiplier that is applied during period of increased demand. If this field is empty, there is no surge pricing.++Example:+This example demonstrates a pricing scheme that has a rate both by minute and by km. The user is charged $0.25 per km as well as $0.50 per minute. Both of these rates happen concurrently and are not dependent on one another. +```jsonc+{+  "plans": {+    "plan_id": "plan2",+    "start_time": "7:00:00",+    "end_time": "9:30:00",+    "vehicle_type_id": "def",+    "name": "Rush Hour Rate",+    "currency": "CAD",+    "price": 3,+    "is_taxable": true,+    "description": "$3 unlock fee, $0.25 per kilometer and $0.50 per minute",+    "variable_price": [+      {+        "variable_unit": "km",+        "rate_segments": {+          "start": 0,+          "rate": 0.25+        }+      },+      {+        "variable_unit": "minute",+        "rate_segments": {+          "start": 0,+          "rate": 0.5+        }+      }+    ]+  }+}+```++Example:++The user does not pay more than the base price for the first 10 km. After 10 km the user pays $1 per km. After 25 km the user pays $0.50 per km and an additional $3 every 5 km, the extension price, in addition to $0.50 per km. ++```jsonc+ "variable_price": {+   "variable_unit": "km",+   "rate_segments": [+     {+       "start": 10,+       "rate": 1+     },+     {+       "start": 25,+       "rate": 0.5+     }+   ]+   "flat_segments": [+     {+       "start": 25,+       "price": 3,+       "interval": 5,+     }+   ]+ }

Per the description above variable_price is an array.

"variable_price": [
    {
        "variable_unit": "km",
        "rate_segments": [
            {
                "start": 10,
                "rate": 1
            },
            {
                "start": 25,
                "rate": 0.5
            }
        ],
        "flat_segments": [
            {
                "start": 25,
                "price": 3,
                "interval": 5
            }
        ]
    }
]
josee-sabourin

comment created time in 16 days

PullRequestReviewEvent

issue commentjiffyclub/snakeviz

A function called by different function should have different called-info

This is definitely a weird case! But yeah, what you're observing is due to cProfile only reporting the total time spent in a function, not differentiating how much time is spent when called in different call trees. SnakeViz displays exactly what's in the cProfile data.

witie41

comment created time in a month

GollumEvent

pull request commentjiffyclub/snakeviz

fix overlapping buttons

Thanks, I'll test this out when I get a chance!

Freestackmejai

comment created time in a month

PullRequestReviewEvent

PR opened openmobilityfoundation/mobility-data-specification

Clarify trips and status changes response behavior

In MDS 0.4.x we request trips and status changes for a given hour. A provider may have no data to report for the requested hour multiple reasons, including:

  • The hour has not yet fully passed
  • The provider was not operational in the region during the hour
  • The provider has not yet completed processing that hour's data
  • No trips or events occurred during the hour

Differentiating the last two reasons is particularly important because it lets consumers of APIs know whether or not they need to re-request the hour at a later time. A successful 200 response with an empty list of data clearly communicates that the provider has nothing to report for that hour and that it's not necessary to try again later. Having this behavior consistent across providers would help us at Populus spend less time requesting data and reduce the number of requests received by providers.

+10 -2

0 comment

1 changed file

pr created time in a month

create barnchpopulus-ai/mobility-data-specification

branch : 404-clarification

created branch time in a month

pull request commentjiffyclub/snakeviz

Delete ez_setup.py

Good call! Also need to update setup.py I think: https://github.com/jiffyclub/snakeviz/blob/1da62e118d4f1704f991a12e79d29ea3cf981dec/setup.py#L3-L8

embray

comment created time in a month

issue commentjiffyclub/snakeviz

Does not work on python 3.8 under Windows

i got you gif

stanmart

comment created time in 2 months

issue commentmatplotlib/matplotlib

Add .colorblindfriendly attribute to colormaps, docs, _repr_png_

Definitely sounds like a good idea to me to have this metadata to help with colormap discovery and selection. Where it was available I'd try to make it available in palettable as well.

westurner

comment created time in 2 months

push eventjiffyclub/scipy-2020-intro-to-python

Matt Davis

commit sha 7ce48971ec7fef735d27c535b1c831221c50717c

Add additional comments to function exercises

view details

push time in 3 months

issue commentjupyter/nbviewer

nbviewer does not flush cache

Looks like some form of this is still an issue, I've been waiting for this notebook view to get refreshed for a couple of hours now. No combination of flush_cache flags or browser cache clearing seems to be helping. I get the same result for new browsers and incognito windows.

shinokada

comment created time in 3 months

push eventjiffyclub/scipy-2020-intro-to-python

Matt Davis

commit sha 6fcbf45a3a84131ed8111f4560f34eadce28fe47

Adding notes and function examples to Playing with Blocks

view details

push time in 3 months

push eventjiffyclub/scipy-2020-intro-to-python

Matt Davis

commit sha 3986629392e4fd7a75fd3aeb7f24817f5c1d8496

Pushing notebook with solutions

view details

push time in 3 months

push eventjiffyclub/scipy-2020-intro-to-python

Matt Davis

commit sha 3ce1dc9abba8aa1da39be79a1295cd0b54ba9dbc

Updating notebook versions

view details

push time in 3 months

more