This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class Something: | |
| def __init__(*args, **kwargs): | |
| pass | |
| def foo(a=None, b=None, c=None, d=100): | |
| # We can't add *args and Something specific **kwargs to above signature | |
| # since *args need to come before **kwargs | |
| something = Something() | |
| # |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| FROM python:3.6-buster as builder | |
| # - Install gsutil to copy wheels from gcr | |
| # - Install openblas | |
| # - Download torch & xla | |
| # - Setup Python 3.6 env for Torch XLA wheels | |
| # - Install torch & xla | |
| RUN echo "deb [signed-by=/usr/share/keyrings/cloud.google.gpg] https://packages.cloud.google.com/apt cloud-sdk main" | tee -a /etc/apt/sources.list.d/google-cloud-sdk.list && \ | |
| apt-get install -y apt-transport-https ca-certificates gnupg curl && \ | |
| curl https://packages.cloud.google.com/apt/doc/apt-key.gpg | apt-key --keyring /usr/share/keyrings/cloud.google.gpg add - && \ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <!DOCTYPE html> | |
| <html lang="fa"> | |
| <head> | |
| <title>displaCy</title> | |
| </head> | |
| <body style="font-size: 16px; font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol'; padding: 4rem 2rem; direction: rtl"> | |
| <figure style="margin-bottom: 6rem"> | |
| <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xml:lang="fa" id="6cc1af9f34a64a4592fa784da0aa419f-0" class="displacy" width="3650" height="887.0" direction="rtl" style="max-width: none; height: 887.0px; color: #000000; background: #ffffff; font-family: Arial; direction: rtl"> | |
| <text class="displacy-token" fill="currentColor" text-anchor="middle" y="797.0"> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| use "ponytest" | |
| use "ponycheck" | |
| use ".." | |
| interface val _TestSemigroupAssociativity[T] is UnitTest | |
| fun semigroup(): Semigroup[T] | |
| fun t(): String |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| use "ponytest" | |
| use "ponycheck" | |
| class iso AdditionAssociativeProperty is UnitTest | |
| fun name(): String => "u8/addition-associative" | |
| fun apply(h: TestHelper)? => | |
| let g = recover val Generators.zip3[U8, U8, U8]( | |
| Generators.u8(), Generators.u8(), Generators.u8() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import faust | |
| from faust import TopicT | |
| import asyncio | |
| class MyBlockingService(faust.Service): | |
| def __init__(self, success_topic: TopicT, *args): | |
| super().__init__(*args) | |
| self.success_topic = success_topic |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| override def registerUser(): ServiceCall[requests.RegisterUser, UUID] = ServerServiceCall { req => | |
| repository.emailHasBeenRegistered(req.email).flatMap { beenRegistered => | |
| logger.debug(s"Email ${req.email} has been registered? $beenRegistered") | |
| if (!beenRegistered) { | |
| val id = UUID.randomUUID() | |
| logger.debug(s"Registering user $id") | |
| userEntityFor(id) | |
| .ask(InternalRegisterCommand(id, req.firstName, req.lastName, req.email, req.password)) | |
| } else { | |
| logger.warn(s"Email ${req.email} has already been registered") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Tried with 2.11.8, 2.12.3, 2.12.4 | |
| scalaVersion in ThisBuild := "2.12.3" | |
| // Tried with scoverage 1.5.1, 1.6.0-M3 | |
| // Tried with sbt 1.0.4, 1.1.1 | |
| lazy val commonSettings = Seq( | |
| parallelExecution in Test := false, | |
| organization := "com.example.blah" | |
| ) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import com.lightbend.lagom.scaladsl.api.transport.Forbidden | |
| import com.lightbend.lagom.scaladsl.api.{Service, ServiceCall} | |
| import com.lightbend.lagom.scaladsl.server.PlayServiceCall | |
| import play.api.libs.openid.{OpenIdClient, UserInfo} | |
| import play.api.mvc.EssentialAction | |
| import scala.concurrent.{ExecutionContext, Future} | |
| /** | |
| * A trait which will provide OpenID authentication when provided with an OpenID client. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from unittest import TestCase | |
| from nltk import FeatureEarleyChartParser, load, word_tokenize | |
| class ParserTestCase(TestCase): | |
| def setUp(self): | |
| self.grammar = load("file:{0}".format("./grammar.fcfg")) | |
| self.parser = FeatureEarleyChartParser(self.grammar, trace=0) | |
| def __should_parse(self, sentence): |